there is:

   0 1 0 1 (# ,:~ -.@:[ # ]) i.4 
0 2 
1 3 

or as an adverb that uses a function (of the data) to split the data

   2&| 1 : '(-.@:u # [) ,: u # ]' i.8 
0 2 4 6 
1 3 5 7 


----- Original Message -----
From: Andrey Paramonov <[email protected]>
To: "[email protected]" <[email protected]>
Cc: 
Sent: Thursday, October 9, 2014 6:00 PM
Subject: [Jprogramming] Splitting vector

Hello everyone,
What is the best way in J to split a vector into two vectors by even and odd 
indices? For example, for this input

0 1 2 3 4 5 6 7
I want the following output

0 2 4 6

1 3 5 7



Thank you.
                          
----------------------------------------------------------------------
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