The snippet below produces a value for r which I would like to produce more
elegantly: without the for. loop suggested by the repeated building of
r-values. Perhaps a gerund-powered amend could work, but I am not
optimistic enough to travel there without some encouragement.

The result in r is attempting to move the array w to each of the 4 corners
of the array i, in turn.

*******snippet below*******

   combis =: #:i. 4
   w=: 2 2$'abcd'
   i=: 3 3$'MNOPQR'
   combis<"1@:{2<\i. 3
┌─────────┬─────────┬─────────┬─────────┐
│┌───┬───┐│┌───┬───┐│┌───┬───┐│┌───┬───┐│
││0 1│0 1│││0 1│1 2│││1 2│0 1│││1 2│1 2││
│└───┴───┘│└───┴───┘│└───┴───┘│└───┴───┘│
└─────────┴─────────┴─────────┴─────────┘
   ]r=:w (<0 1;0 1)}i
abO
cdR
MNO
   r=:r,:w (<0 1;1 2)}i
   r=:r, w (<1 2;0 1)}i
   ;/r=:r,w (<1 2;1 2)}i
┌───┬───┬───┬───┐
│abO│Mab│MNO│MNO│
│cdR│Pcd│abR│Pab│
│MNO│MNO│cdO│Mcd│
└───┴───┴───┴───┘


Thanks,

-- 
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to