MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Any simple way to flatten all but the bottom level?


I think I have a simple solution for you using repeated replace

l={{{1, 3, 4}, {4, 6, 7}, {{1, 2, 3}, {3, 5}}}, {1, 2, 3}}
{l //. {x : {___} ...} -> x}
{{1, 3, 4}, {4, 6, 7}, {1, 2, 3}, {3, 5}, {1, 2, 3}}

Best regards,

PJW

dontdont at gmail.com wrote:
> 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


  • Prev by Date: Re: RSolve and known indexed variables
  • Next by Date: Re: ReplaceAll applied to List - solution
  • Previous by thread: Re: Any simple way to flatten all but the bottom level?
  • Next by thread: Re: Any simple way to flatten all but the bottom level?