Rereading your original post, I see the requirement for nub.

Here's a couple variants for that:

~.@f   (if ~. isn't in f)

or

f=: ~.@ix/

Then again, we could have gone:

ix=: ~.@[ -. -.

FYI,

-- 
Raul

On Tue, Oct 23, 2018 at 12:18 PM Skip Cave <[email protected]> wrote:
>
> NB. Raul proposes:
>
> f =. ix /
>
> f h
>
> 5 3 5
>
> NB. Still need a nub.
>
>
> NB. Add the nub
>
> f =. ~. ix /
>
> f h
>
> |domain error: f
>
>
> NB. Robert's suggestion:
>
> f =. [:~. ix /
>
> f h
>
> 5 3
>
> NB. Correct!
>
> Skip
>
> On Tue, Oct 23, 2018 at 11:04 AM 'robert therriault' via Programming <
> [email protected]> wrote:
>
> > Hi Skip,
> >
> > Your version of f is a hook, as Raul points out, and I think that you want
> > it to be a fork with a left tine of [: so that ~. is executed after ix/
> >
> >     h=.4 5$ 1 5 3 4 5 3 5 4 5 6 5 3 7 5 8 3 8 5 1 5
> >    ix =: ([ -. -.)
> >    f =. [: ~. ix /
> >    f h
> > 5 3
> >
> > Cheers, bob
> >
> > > On Oct 23, 2018, at 8:44 AM, Skip Cave <[email protected]> wrote:
> > >
> > > f =. ~. ix /
> >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to