> > Didn't check #combinations:* implementation, does it avoid #includes: ?
I think so. It calls #combinationsAt:in: after: do: wich is recursive. > >> I'd still prefer #combinationsSize:do: instead of >> #combinations:atATimeDo: > > +1 but it looks alt-w friendly already (like #detectSum: looks ;) > Funny to see it was probably the original name. See the comment of #combinationsAt:in: after: (last line) "Choose k of N items and put in aCollection. jj-1 already chosen. Indexes of items are in numerical order, to avoid the same combo being used twice. In this slot, we are allowed to use items in self indexed by nn+1 to self size. nn is the index used for position jj-1." "(1 to: 6) combinationsSize: 3 do: [:each | Transcript cr; show: each printString]" Cédrick >>> >>> 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 >>> > > > _______________________________________________ > Beginners mailing list > Beginners@lists.squeakfoundation.org > http://lists.squeakfoundation.org/mailman/listinfo/beginners >
_______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners