I said:
> On 18 Jul 2006 at 23:06, Andrew Nikitin said:
>
> > greg heil:
> > > > '*' ((<1;2 3),<0;7) } 2 9$'-'
> > >
> > > Quoting j4c p165 pn the subject of amend:
> > >
> > > "The interpreter may incorrectly modify the first atom in the array if
> > > the atoms of m select portions of y that do not have the same shape.
> > > You should avoid such m"
>
> FWIW,
> '*' ((<1;2 3),<0;7 7) } 2 9$'-'
> -------*-
> --**-----
>
> If you could produce an adverb that would map
> ((<1;2 3),<0;7)
> into
> ((<1;2 3),<0;7 7)
> and do something equivalent and suitable in the general case, you'd have a
> fix for the problem.
I have a partial solution.
fix=. 13 : 'x $!.({: y) y' NB. extends y by repeating last item
fixall =: 13 '<"(1) 4 fix each > y'
'*' (fixall (<1;2 3),<0;7) } 2 9$'-'
-------*-
--**-----
(fixall (<1;2 3),<0;7)
+-----------------+-----------------+
|+-------+-------+|+-------+-------+|
||1 1 1 1|2 3 3 3|||0 0 0 0|7 7 7 7||
|+-------+-------+|+-------+-------+|
+-----------------+-----------------+
The "4" in fixall is arbitrary (2 would suffice in the given example).
The ideal is to apply fix to each inner box with its left operand equal
to the max of the $ taken over corresponding inner boxes. But I can't
work out the syntax to do this.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm