Hi,

Gather seems excellent. Could not find it. Don't need the nil check.

Thanks,

Kind Regards,

Bart

On Sat, Dec 26, 2009 at 11:30 PM, Julian Fitzell <[email protected]> wrote:

> Fyi, PackageInfo (and thus base Pharo currently) defines
> Collection>>gather: which has basically this behaviour (minus the nil
> check). I had this marked as a method for discussion when going
> through the VASt/Pharo collection protocols.
>
> I think #collectAll: is problematic as a selector because "All:"
> suggests a collection passed as a parameter.
>
> Another possible pattern would be to model after :flatten in Ruby,
> though it operates recursively, so it might not be the best name here.
> Maybe #gather: is actually fine.
>
> Julian
>
> 2009/12/26 Bart Gauquie <[email protected]>:
> > Dear all,
> > Another one was:
> > Set>>collectAll: aBlock
> >   | newSet |
> >    newSet := Set new: self size.
> >    array do: [:each | each ifNotNil: [newSet addAll: (aBlock value:
> each)]].
> >    ^ newSet
> >
> > In analogy with addAll: aCollection. If useful, maybe we should provide a
> > more general implementation for Collection instead of only Set I needed
> so
> > far.
> > Kind Regards,
> > Bart
> > --
> > imagination is more important than knowledge - Albert Einstein
> > Logic will get you from A to B. Imagination will take you everywhere -
> > Albert Einstein
> > Learn from yesterday, live for today, hope for tomorrow. The important
> thing
> > is not to stop questioning. - Albert Einstein
> > The true sign of intelligence is not knowledge but imagination. - Albert
> > Einstein
> > Gravitation is not responsible for people falling in love. - Albert
> Einstein
> >
> > _______________________________________________
> > 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
>



-- 
imagination is more important than knowledge - Albert Einstein
Logic will get you from A to B. Imagination will take you everywhere -
Albert Einstein
Learn from yesterday, live for today, hope for tomorrow. The important thing
is not to stop questioning. - Albert Einstein
The true sign of intelligence is not knowledge but imagination. - Albert
Einstein
Gravitation is not responsible for people falling in love. - Albert Einstein
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to