J Knitting : The Naive Corner...
This one is eluding me...
] A =. 1 2 ; 1 2 3
┌───┬─────┐
│1 2│1 2 3│
└───┴─────┘
] P =. (2 _2)
2 _2
i want to add the first [2] to each of the first [1 2]
and add second [_2] to each of the second [1 2 3]
as in :
(2 _2) Jmagic (1 2; 1 2 3)
┌───┬──────┐
│3 4│_1 0 1│
└───┴──────┘
.. but that bit of Jmagic is eluding me.
I don't really have a handle on this kind of thing .. i usually hack
and get it in a couple of goes, but this one's being slippery. Snapping
open those boxes, fiddling with the contents and snapping them closed
before any spurious fillers sneak in is what i find to be particularly
tricky. In this case i can't seem to orient and open things up so
they're pointed in the right direction. In the best of a bad lot i got
the right additions but got a spurious [2] filler too.
.. anyone have a solution .. plus any helpful visualisation tips for
dealing with arrays that become ragged and boxed?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm