[Squeak] Newbie permutations
Avi Bryant
avi at beta4.com
Tue Apr 9 07:15:15 UTC 2002
On Mon, 8 Apr 2002, Michael Grant wrote:
> #(1 3 5) permutationsDo: [:each | Transcript cr;
> show: each
> printString].
>
> However, I can not figure out how to save the permutations to a
> variable, say 'Foo', with Foo having the value:
>
> #(#(1 3 5) #(1 5 3) #(3 1 5)...)
| foo |
foo := OrderedCollection new.
#(1 3 5) permutationsDo: [:each | foo add: each].
Does that do it for you?
More information about the Squeak-dev
mailing list
|