[Jprogramming] cyclical copy
Nick Simicich
simicich at gmail.com
Sat Dec 31 12:07:35 HKT 2011
I think that the question has to be answered, "It depends on the data that
is being copied."
Consider:
;3#<1 2 3
which gives the answer you want for the data you have. It boxes the data,
internally creates a set of three boxes and then razes the data out of
them. But you might want to deal with a large amount of data of mixed type
which is previously boxed. It also works as
;3$<1 2 3
Consider:
>3$<(< 1 2 ), <'x'
or ,>3$<(< 1 2 ), <'x'
To help you understand this, try
3$<(< 1 2 ), <'x'
Again, 3#<(< 1 2 ), <'x' also works.
On Fri, Dec 30, 2011 at 1:42 PM, Johann Hibschman <jhibschman at 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
>
--
Of course I can ride in the carpool lane, officer. Jesus is my constant
companion.
More information about the Programming
mailing list