$ accomplishes this quite nicely.

   4 $ 1 2
1 2 1 2
   2 5 $ 1 2
1 2 1 2 1
2 1 2 1 2

Note, however, that $ always applies to the items of its right argument;
behavior with a rank >1 right argument is confusing.

Marshall

On Fri, Dec 30, 2011 at 1:42 PM, Johann Hibschman <jhibsch...@gmail.com>wrote:

> Continuing my J 101 questions, what's the best way to do a cyclical
> (as opposed to element-wise) copy?
>
> (2#1 2) gives (1 1 2 2), I want (1 2 1 2). The best I've come up with
> is (,2#,:1 2). Is there a better way, or is that it?
>
> Cheers,
> Johann
> ----------------------------------------------------------------------
> 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