By imitating the idiom
 z=:  $ /:@;@(<@|.`</.)@i.

the solution is trivial
 s=:  $ /:@;@(<onion)@i.

where onion is the adverb to partition an array in onion manner. adverb onion
will be implemented by someone else. (oo paradigm)

Roger Hui wrote:
> Now that we have mastered zigzag order, how about the
> spiral order?  For example, the spiral order for a 
> 4 5 array is:
> 
>  0  1  2  3 4
> 13 14 15 16 5
> 12 19 18 17 6
> 11 10  9  8 7
> 
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 
> 


-- 
regards,
bill
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to