Sometimes the two lengths will not be the same so you may need to treat them
separately.

  (($A)$1 0)#A=:i.20
0 2 4 6 8 10 12 14 16 18
   (($A)$0 1)
1 3 5 7 9 11 13 15 17 19
   
   ]B=:20?20
0 8 11 6 13 2 7 12 19 5 1 14 16 3 10 15 4 18 9 17
   (-.2|B)#B
11 13 7 19 5 1 3 15 9 17
   (-.2|B)#B
0 8 6 2 12 14 16 10 4 18
   
   ]C=:?20$20
10 6 9 6 7 16 10 0 11 1 8 3 10 19 12 14 5 1 6 7
   (2|C)#C
9 7 11 1 3 19 5 1 7
   (-.2|C)#C
10 6 6 16 10 0 8 10 12 14 6
   
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of robert
therriault
Sent: Thursday, October 09, 2014 6:15 PM
To: [email protected]
Subject: Re: [Jprogramming] Splitting vector

Hi Andrey,

My first idea is infix, the dyadic mode of \ feeding into monadic transpose
|:

   t=. |: @: (_2 ]\  ])
   t 0 1 2 3 4 5 6 7
0 2 4 6
1 3 5 7

Others will have more informed feelings about the best way, but this would
work.

Cheers, bob

On Oct 9, 2014, at 3:00 PM, Andrey Paramonov <[email protected]> wrote:

> 0 1 2 3 4 5 6 7

----------------------------------------------------------------------
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