Re: Any simple way to flatten all but the bottom level?
- To: mathgroup at smc.vnet.net
- Subject: [mg72457] Re: [mg72323] Any simple way to flatten all but the bottom level?
- From: "Josef Otta" <josef.otta at gmail.com>
- Date: Fri, 29 Dec 2006 05:03:44 -0500 (EST)
Hi, Try to do this: data = {{0, 0, 0}, {{0, 0, 13}, {0, 1, 9}, {0, 2, 5}, {0, 3, 1}}, {{1, 0, 4}, {1, 1, 0}}}; sol=Partition[Flatten[data,Infinity],3] I hope that it can solve your problem in easy and in relatively effective way. Josef Otta 2006/12/26, dontdont at gmail.com <dontdont at gmail.com>: > > Am I overlooking something I should be able to see? > > When I Nest Table I sometimes produce things like this > > {{0, 0, 0}, {{0, 0, 13}, {0, 1, 9}, {0, 2, 5}, {0, 3, 1}}, {{1, 0, 4}, > {1, 1, 0}}} > > where each triple is actually one solution I'm looking for. > But I don't see a simple way to transform this result into > > {{0, 0, 0}, {0, 0, 13}, {0, 1, 9}, {0, 2, 5}, {0, 3, 1}, {1, 0, 4}, {1, > 1, 0}} > > I would have guessed there would be a way to coax Flatten to do this. > > Thus far I haven't found what looks like a good method. > I have found a few awkward and bad ways but no simple clean way. > > Would anyone enlighten me? > > thanks > >