If you're after the J equivalent of APL's Enlist then this should do the job:

   ; <@, S:0 test

or:
   enlist=: [: ; <@, S:0
   enlist test

On Mon, Aug 22, 2011 at 9:03 PM, Henry Rich <[email protected]> wrote:
> Not sure what you mean by flatten, but
>
>    ; < S:0 test
> 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
>
> Henry Rich
>
> On 8/22/2011 4:14 AM, Gregory Nisbet wrote:
>> I want to flatten a list containing boxed elements.
>>
>> a =: 1 ; 2 3 ; 4 5
>> b =: a ; a
>> a =: b ; b
>> test =: a ; b
>>
>> the array test thus contains many test boxes and was the ad hoc test case I
>> was trying to flatten.
>>
>> flattening a multidimensional array is simple enough ,/^:_
>>
>> but thus far, I can't seem to figure out how to flatten test and other
>> similarly convoluted nested boxes.
>>
>> It particularly baffles me that>  test and>"_1 test both result in errors.
>> It seems like there's something simple I'm missing, but I can't quite figure
>> out what.
>>
>> Any help would be much appreciated.
>> ----------------------------------------------------------------------
>> 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

Reply via email to