MathGroup Archive 2009

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

Search the Archive

Re: All Possible Combinations from N Sublists


Tuples[myList]

Cheers -- Sjoerd

On Mar 17, 12:01 pm, Donald DuBois <don... at comcast.net> wrote:
> Given a list of N sublists, how can I produce all possible combinations where the first
> element comes from the first sublst, the second element from the second sublist etc.
>
> For instance,
>
> myList = {{1, 2, 3}, {e, f}, {g, h}}
>
> the result should be,
>
> {{1, e, g}, {1, e, h}, {1, f, g}, {1, f, h}, {2, e, g}, {2, e, h}, {2, f,
>   g}, {2, f, h}, {3, e, g}, {3, e, h}, {3, f, g}, {3, f, h}}
>
> Thank you.



  • Prev by Date: multiple points in WorldPlot
  • Next by Date: Re: econometrics with mathematica?
  • Previous by thread: Re: All Possible Combinations from N Sublists
  • Next by thread: Re: All Possible Combinations from N Sublists