It can be useful for testing equivalency

(({.;}.) -: split) 'abcd'

1


(({.;}.) -: split) (1 2 3 4)

1


(({.;}.) -: split) (i. 2 3 4)


1

Which made me wonder, why is split defined as with ,&< instead of the
simpler ; -- or so it seems?


@Raul - the intersect example was quite interesting to me. I would
naturally think of an intersection as match all A in B


Something like:

intersect2=:(i. (< #) [)~ # [


A=:1 2 3 4 5

B=:4 5 6 7 8 9


A (intersect2 -: intersect) B

1


B (intersect2 -: intersect) A

1


intersect=: [ -. -.


Is a bit of a logic problem. Let C be A that's not in B. A that is not C is
equal to A in B. That logic path would not have crossed my mind


A=:(1 2 3 4)

B=:(3 4 5 6)

C=:A-.B

]A-.C

3 4


A ([ -. -.) B

3 4




On Wed, Jul 16, 2014 at 6:29 PM, Raul Miller <rauldmil...@gmail.com> wrote:

> Do you care what the trains are used for?
>
> One of the classic trains is set intersection:
>
> intersect=: [ -. -.
>
> Thanks,
>
> --
> Raul
>
>
> On Wed, Jul 16, 2014 at 4:26 PM, 'Dan Baronet' via Programming
> <programm...@jsoftware.com> wrote:
> > I am looking for good examples of use of trains.
> > Apart from the classic +/ % #, I can't think of many more.
> > Anyone with some examples? They can be of any length.
> > /Dan
> > ----------------------------------------------------------------------
> > 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