Hi

I seem to be having a bit of trouble performing this idea.

I am trying to get a subset of a list, and comparing the first element
against the last element of the result.


    2 >\/ (1 2 3 4 1 2 3 4)
1 2
2 3
3 4
4 1
1 2
2 3
3 4

t1 =: 4 : '(_1{a) -: (0{ a=. y >\/ (x))'
   1 2 3 4 1 2 3 4 t1 2
0


   4 >\/ (1 2 3 4 1 2 3 4)
1 2 3 4
2 3 4 1
3 4 1 2
4 1 2 3
1 2 3 4

   1 2 3 4 1 2 3 4 t1 4
1

t1 works as intended, but I am having trouble making it work with more
than one right argument at a time
Here are my failed attempts.

   1 2 3 4 1 2 3 4 t1 2 3 4 NB. result should be 0 0 1
0

   1 2 3 4 1 2 3 4 t1"0 2 3 4
|length error
|   1 2 3 4 1 2 3 4     t1"0 2 3 4

   1 2 3 4 1 2 3 4 t1 each (2 3 4)
|length error
|   1 2 3 4 1 2 3 4     t1 each(2 3 4)

   (1 2 3 4 1 2 3 4) t1"0 (2 3 4)
|length error
|   (1 2 3 4 1 2 3 4)    t1"0(2 3 4)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to