Re: de-nesting complex nested lists

• To: mathgroup at smc.vnet.net
• Subject: [mg111280] Re: de-nesting complex nested lists
• From: Vince Virgilio <blueschi at gmail.com>
• Date: Mon, 26 Jul 2010 06:37:04 -0400 (EDT)
• References: <i2gjui\$am\$1@smc.vnet.net>

On Jul 25, 2:00 am, Michael Stern <nycst... at gmail.com> wrote:
> If one has an irregularly nested list like
>
> {{1, 2, 3}, {1, 2,  4}, {{1, 2, 3, 4}, {1, 2, 3, 8}}, {{1, 2, 9}, {{1, 2, 13}, {4, 5, 6}}}},
>
> How might one most easily transform this into a list of uniform Depth 2 ( {{1,2,3},{1,2,4},{1,2,3,4},{1,2,3,8},{1,2,9},{1,2,13},{4,5,6}} ) ?
>
>
> Michael

Michael,

Use Level.

In[1]:=
irreg={{1,2,3},{1,2,4},{{1,2,3,4},{1,2,3,8}},{{1,2,9},{{1,2,13},
{4,5,6}}}};
soln={{1,2,3},{1,2,4},{1,2,3,4},{1,2,3,8},{1,2,9},{1,2,13},{4,5,6}};
uni=Level[irreg,{-2}];
uni==soln

Out[4]= True

Vince Virgilio

• Prev by Date: Re: de-nesting complex nested lists
• Next by Date: Re: mathematica gives strange result
• Previous by thread: Re: de-nesting complex nested lists
• Next by thread: Re: de-nesting complex nested lists