On Wed, Aug 26, 2009 at 2:48 PM, Dan Bron<[email protected]> wrote:
> Well, yes.  This is how I do it currently, with my nester (which breaks if
> the content to nest are boxes).  What I meant is:  can your nester be
> applied to boxes in the first place?

First, I just noticed, I had left 3 in my code, instead of infinity.
Please use this definition instead:
   gather=: [: ({."1 </. }."1)^:(1 < {:@$)L:0^:_ group |:@}.@, {...@]
(I prefer to avoid using infinity during development, because
jbreak is so often inconvenient for me to find and use, when I
need it.)

Anyways, philosophically speaking, this should be doable, but a
lot of my intermediate results are rank 2 arrays of integers with the
"result" integers mixed in with everything else.

For the most part, they are just being carried along, inertly

   depth NEST
1 2 3 4 5 6 7 9 10 11 12 14 15 17 18 19 20 21 22
2 2 2 2 2 2 2 3  3  3  3  2  2  1  1  1  1  1  1
   group depth NEST
1 1 1 1 1 1 1 1 1 1 1 1  1  1  1  1  1  1  1
1 1 1 1 1 1 1 1 1 1 1 1  1  2  3  4  5  6  7
1 2 3 4 5 6 7 8 8 8 8 9 10 11 12 13 14 15 16

And, hypothetically speaking, am not doing anything
interesting with them until I get to boxing them, but
you would need to restructure 'gather' since it currently
assumes everything is an integer.

Basically, gr...@depth comes up with left arguments
for a F/. expression such that if they are done in sequence
everything will be nested appropriately.  If you were manipulating
integers separately from the boxed tokens, I think you would
need to do this kind of thing twice: once for the integers
and again for the boxed tokens.

FYI,

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to