pity that something like this wont work for the fill portion of the 2
dimensional n-laminate .
L=:(1 1 1 _. _. _. _.),(1 1 1 1 1 _. _.),:(1 1 1 1 1 1 1)
A=:(i.3),(i.5),:(i.7)
L*A
because
0*_.
0
but A+L does it!
Now to come up with the 1 and _. matrix based on a list of boxes.
B=:(1; 1 2 3; 1 2 3 4 5)
max=:>./ > # each B
((1$~,_.$~max-)#) each B
|domain error
almost. But 1$~,_. on its own works.
-Steven
On 11 December 2010 09:12, Steven Taylor <[email protected]> wrote:
> Hi,
>
> I like the way ,:!.f works. It's quite neat.
>
> What would be even better is if > open behaved a little like ,: does with
> it's fill conjunction.
>
> e.g.
> f=:_.
> [A=:(i.3),:!.f(i.5)
> 0 1 2 _. _.
> 0 1 2 3 4
>
> we can extend that further with
> [A=:A,!.f(i.7)
> (but I suppose we've got a full copy of the existing A each time if we
> were worried about performance.)
>
> In any case, something like this just looks more elegant:
>
> L=:(i.3);(i.5);(i.7)
> > L
> 0 1 2 0 0 0
> 0 1 2 3 0 0
> 0 1 2 3 4 5
>
> >!.f L
> |domain error
>
> any ideas? I migh play with something like this later: get count, get max
> count of each boxed list. Prebuild filled array. Utilise special code form
> of ammend... but there could be a loop :(
>
> thanks,
> -Steven
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm