Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

RE: Combinations

  • To: mathgroup at
  • Subject: [mg49706] RE: [mg49672] Combinations
  • From: "David Park" <djmp at>
  • Date: Thu, 29 Jul 2004 07:43:21 -0400 (EDT)
  • Sender: owner-wri-mathgroup at


Flatten[Outer[List, {a, b, c}, {a, b, c}, {a, b, c}], 2];
Map[SymbolName, %, {2}];
StringJoin@# & /@ %

List["aaa", "aab", "aac", "aba", "abb", "abc", "aca", "acb", "acc", "baa", \
"bab", "bac", "bba", "bbb", "bbc", "bca", "bcb", "bcc", "caa", "cab", "cac",
"cba", "cbb", "cbc", "cca", "ccb", "ccc"]

David Park
djmp at

From: Gregory Lypny [mailto:gregory.lypny at]
To: mathgroup at

Hello everyone,

Does Mathematica have a built-in function that will generate a simple
list all possible combinations of a list of strings?  For example,
{a,b,c}, where the elements are strings, should give 3x3=27 triplets of
"aaa", "aba", etc.

I tried


but I get

{{{a, b, c}[a, a], {a, b, c}[a, b], {
     a, b, c}[a, c]}, {{a, b, c}[b, a], {a, b, c}[b, b], {a, b,
       c}[b, c]}, {{a, b, c}[c, a], {a, b, c}[c, b], {a, b, c}[c, c]}}

which is going to be difficult to match with my data using BinCounts
and the like.



  • Prev by Date: Why overloaded arithmetic operations are so slow?
  • Next by Date: Re: Combinations
  • Previous by thread: Re: Combinations
  • Next by thread: Re: Combinations