Thanks!
> From: [email protected] > Date: Sun, 30 Nov 2014 09:54:59 -0500 > To: [email protected] > Subject: Re: [Jprogramming] Flatten a boxed array > > arr =: (< 3 4) ; (3; <'HELLO'; << 'HI'); 'WORLD' NB. just random boxes > <S:0 arr > ┌───┬─┬─────┬──┬─────┐ > │3 4│3│HELLO│HI│WORLD│ > └───┴─┴─────┴──┴─────┘ > > See also: > http://rosettacode.org/wiki/Flatten_a_list#J > http://rosettacode.org/wiki/Tree_traversal#J > > Thanks, > > -- > Raul > > > On Sun, Nov 30, 2014 at 9:34 AM, Jon Hough <[email protected]> wrote: > > What is the best way to flatten a box array of arbitrary depth? > > > > e.g. if I have > > > > > > arr =: (< 3 4) ; (3; <'HELLO'; << 'HI'); 'WORLD' NB. just random boxes > > > > > > ┌─────┬────────────────┬─────┐ > > │┌───┐│┌─┬────────────┐│WORLD│ > > ││3 4│││3│┌─────┬────┐││ │ > > │└───┘││ ││HELLO│┌──┐│││ │ > > │ ││ ││ ││HI││││ │ > > │ ││ ││ │└──┘│││ │ > > │ ││ │└─────┴────┘││ │ > > │ │└─┴────────────┘│ │ > > └─────┴────────────────┴─────┘ > > and I want to make > > > > > > ┌───┬─┬─────┬──┬─────┐ > > │3 4│3│HELLO│HI│WORLD│ > > └───┴─┴─────┴──┴─────┘ > > That is, all boxed items are moved to the top. > > > > > > > > > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
