Re: Combinations

• To: mathgroup at smc.vnet.net
• Subject: [mg49710] Re: Combinations
• From: Erich Neuwirth <erich.neuwirth at univie.ac.at>
• Date: Thu, 29 Jul 2004 07:43:28 -0400 (EDT)
• References: <ce5dk5\$b87\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Seq[objs_, length_] :=
Flatten[Apply[Outer, Join[{Join}, Table[Map[List, objs],
{i, 1, length}], {1}]], length - 1]

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

Gregory Lypny wrote:

> 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
>
> In[4]:=Outer[{a,b,c},{a,b,c},{a,b,c}]
>
> 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.
>
> 	Regards,
>
> 		Greg
>

```

• Prev by Date: FindMinimum can't work good. Why?
• Next by Date: Re: Any ways to recover a broken file?
• Previous by thread: Re: Combinations
• Next by thread: Re: Combinations