[Squeak] Newbie permutations

Bijan Parsia bparsia at email.unc.edu
Tue Apr 9 22:48:06 UTC 2002


On Tue, 9 Apr 2002, Andrew C. Greenberg wrote:

> It is an implementation concern that should probably be documented.  I 
> imagine it was done this way because it would be inefficient for 
> applications where copies are not required to have the method make 
> copies in each instance.

Given that the selector is #permutationsDo:, it's perhaps worth having a
separate method, #permutations, which would produce a collection of the
distinct permuations. Then idioms like foo permutations select:...et al
would work as expected.

> On Tuesday, April 9, 2002, at 03:30 AM, Avi Bryant wrote:
> 
> > On Tue, 9 Apr 2002, Duane Maxwell wrote:
> >
> >>> | foo |
> >>> foo := OrderedCollection new.
> >>> #(1 3 5) permutationsDo: [:each | foo add: each].
[snip]

Cheers,
Bijan Parsia.




More information about the Squeak-dev mailing list