[Squeak] Newbie permutations

Andrew C. Greenberg werdna at mucow.com
Wed Apr 10 02:15:35 UTC 2002


Could be.  On the other hand, the utility of #permutations is entirely 
unclear to me.  Even for small collections, the number of permutations 
gathered rate to be fairly large.

On Tuesday, April 9, 2002, at 06:48 PM, Bijan Parsia wrote:

> 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