# [Newbies] Re: Permutations and Combinations

Bert Freudenberg bert at freudenbergs.de
Fri Mar 12 16:55:37 UTC 2010

```On 12.03.2010, at 16:28, Paul DeBruicker wrote:
>
> Sorry.  I hit send inadvertently.
>
>
>
>
> An illustration of what I want is:
>
> |w x y z |
> w:=OrderedCollection with: 'A'
> x:=OrderedCollection with: 'a' with: 'b' with: 'c' with: 'd'.
> y:=OrderedCollection with: '1' with: '2' with:'3'.
> z:=OrderedCollection with: w with: x with: y.
>
> from z I want to get
> #('A' 'a' '1')
> #('A' 'b' '1')
> #('A' 'c' '1')
> #('A' 'd' '1')
> #('A' 'a' '2')
> #('A' 'b' '2')
> #('A' 'c' '2')
> #('A' 'd' '2')
> #('A' 'a' '3')
> #('A' 'b' '3')
> #('A' 'c' '3')
> #('A' 'd' '3')
>
> The permut* functions you helped me find seem to make the permutations
> of the collections, but not the contents of the collections.

Now that looks like simple nested iterations, not permutations:

Array streamContents: [:s |
#('A') do: [:a |
#('a' 'b' 'c' 'd') do: [:b |
#('1' '2' '3') do: [:c |
s nextPut: {a. b. c}]]]]

- Bert -

```