hahhha thanks Nicolas..I was sure somewhere it should be...I was blind...weird I check there!!!
thanks a lot. mariano On Wed, Mar 10, 2010 at 2:07 PM, Nicolas Cellier < [email protected]> wrote: > self collect: aBlock as: Set > > 2010/3/10 Mariano Martinez Peck <[email protected]>: > > Hi. I was needing something like the SQL select distinct, that doesn't > take > > into account repeated objects. I didn't found anything useful in > Collection, > > and thus, I have implemented this: > > > > Collection >> collectDistinct: aBlock > > > > > > collectDistinct: aBlock > > "Evaluate aBlock with each of the receiver's elements as the > argument. > > Collect the resulting values into a Set, thus repeated objects will > not > > be present. > > Answer the new collection." > > > > | newSet | > > newSet := self species new asSet. > > self do: [:each | newSet add: (aBlock value: each)]. > > ^ newSet > > > > > > Is there a better way ? Do you think it make sense to put this in Pharo > ? > > > > Cheers > > > > Mariano > > > > _______________________________________________ > > Pharo-project mailing list > > [email protected] > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > > > _______________________________________________ > Pharo-project mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >
_______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
