[Squeak] Newbie permutations
Torge Husfeldt
jean-jacques.gelee at gmx.de
Tue Apr 9 09:35:00 UTC 2002
Just for completeness:
foo := Array streamContents:
[strm |
#(1 3 5) permutationsDo:
[:perm |
strm nextPut: perm copy"copy needed because there is a bug in
OrderedCollection>>permutationsDo:"]]
> Hello everyone.
>
> I don't know if this is the correct forum but I can
> find no other mailing list so here goes (at 3:00am):
>
> I need a Smalltalk 'AHA!' moment.
>
> The following expression (Squeak 3.0)writes the
> permutations of
> #(1 3 5) to the Transcript as expected:
>
> #(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)...)
>
> My efforts have typically ended up as #(nil nil ...),
> or an error, or
> something like #(#(1 3 5) #(1 3 5) #(1 3 5) ...)
>
> Can someone enlighten me? It must be simple, but...
>
> Thank you,
> Michael Grant
>
> P.S. If there is a more appropriate list for newbie
> please let me know.
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Tax Center - online filing with TurboTax
> http://taxes.yahoo.com/
>
More information about the Squeak-dev
mailing list
|