[Newbies] Re: Another extension proposal -> subsets
cdrick
cdrick65 at gmail.com
Thu Jul 24 13:40:26 UTC 2008
Nicolas, your initials fits you ;)
nice and twice quicker as the bit-sift one.
> You have one messsage #combinations:atATimeDo: to enumerate partitions, but
> in SequenceableCollection, not in Set:
>
> | collec subset |
> collec := 1 to: 4.
> subset := OrderedCollection new: (2 raisedTo: collec size).
> subset add: #().
> 1 to: collec size do: [:subSize |
> collec combinations: subSize atATimeDo: [:subArray | subset add: subArray
> copy]].
> subset
>
> Mind the copy, because the iteration recycle same subArray for economy.
>
I'dnevertheless prefer a name like: #combinationsSize:do:
Cédrick
More information about the Beginners
mailing list