or withNicolas suggestion:
Set>>asPowerset | subset | subset := (OrderedCollection new: (2 raisedTo: self size)) add: Set new; yourself. 1 to: self size do: [:subSize | "don't copy anymore as there is the Set conversion" self asArray combinations: subSize atATimeDo: [:subArray | subset add: subArray asSet]]. ^ subset asSet
I'd still prefer #combinationsSize:do: instead of #combinations:atATimeDo:
How about naming
Collection>>#asPowerset ^ self asSet powersetInto: (Set new: (2 raisedTo: self size))
with Set>>#powersetInto: and putting that into the next release.
/Klaus