Yeah, this was my first attempt, but this implementation is ways slower. The block activations with #collect: matters. My implemebtation only calls primitives or inlined constructs. Not nice to look at, but as fast as it can get.
Lukas On Friday, December 4, 2009, <[email protected]> wrote: > Em 04/12/2009 05:58, Lukas Renggli < [email protected] > escreveu: > >> I wonder if ever something along the following lines was considered? >> >> Dictionary>>keys >> "Answer a Set containing the receiver's keys." >> >> | result | >> result := Set basicNew. >> result setTally: tally array: (array collect: [ :each | >> each isNil ifFalse: [ each key ] ]). >> ^ result > > Why not: > > | result | > result := Set basicNew. > result setTally: tally array: (array collect: [ :each | > each ifNil: [ each key ] ]). > ^ result > > A bit more OO ;-) > > Reading Andrés' book is making more aware of those subtleties :-D > > My .019999... > > - > Cesar Rabak > > _______________________________________________ > Pharo-project mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
