Re: All Possible Combinations from N Sublists
- To: mathgroup at smc.vnet.net
- Subject: [mg97679] Re: [mg97639] All Possible Combinations from N Sublists
- From: Curtis Osterhoudt <cfo at lanl.gov>
- Date: Wed, 18 Mar 2009 04:56:55 -0500 (EST)
- Organization: LANL
- References: <200903171002.FAA17255@smc.vnet.net>
- Reply-to: cfo at lanl.gov
Hi, Donald,
Tuples@myList
{{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}}
Hope that helps!
C.O.
On Tuesday 17 March 2009 04:02:44 am Donald DuBois 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.
>
>
--
==========================================================
Curtis Osterhoudt
cfo at remove_this.lanl.and_this.gov
PGP Key ID: 0x4DCA2A10
Please avoid sending me Word or PowerPoint attachments
See http://www.gnu.org/philosophy/no-word-attachments.html
==========================================================
- References:
- All Possible Combinations from N Sublists
- From: Donald DuBois <donabc@comcast.net>
- All Possible Combinations from N Sublists