[Squeak] Newbie permutations
gaelli at emergent.de
Tue Apr 9 07:54:36 UTC 2002
> Aha. Since this threw me for a second, I should probably explain -
> permutationsDo: is reusing the same array for each permutation. Hence
> need for the #copy in the correct version,
> #(1 3 5) permutationsDo: [:each | foo add: each copy]
> Is there a widespread convention at work here, or is this just a
> pecularity of the implementation of that particular method?
I know at least about one other method, which is quite similar and
where you have to take care to copy each element.
SequencableCollection >> asDigitsToPower: anInteger do: aBlock
SequencableCollection >> asDigitsAt: 1 in: aCollection do: aBlock)
More information about the Squeak-dev