From: Meinrad Recheis Date: 2008-06-04T23:16:01+09:00 Subject: Re: Enumerable::Enumerator#with_memo ------=_Part_9657_2829427.1212589014434 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Wed, Jun 4, 2008 at 10:16 AM, Akinori MUSHA wrote: > At Wed, 4 Jun 2008 03:38:48 +0900, > David Flanagan wrote: > > Akinori MUSHA wrote: > > > Hi, > > > > > > Earlier today I added a new instance method named `with_memo' to > > > Enumerable::Enumerator, but I'm not 100% sure if the name fits the > > > function. > > > > What does the method do? What's the use-case? > > From rdoc: > > call-seq: > e.with_memo(obj) {|(*args), memo_obj| ... } > e.with_memo(obj) > > Iterates the given block for each element with an arbitrary > object given, and returns the memo object. > > If no block is given, returns an enumerator. I like with_memo but I'd propose to call it each_with_memo. I could also imagine the name "each_with_state". -- henon ------=_Part_9657_2829427.1212589014434 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Wed, Jun 4, 2008 at 10:16 AM, Akinori MUSHA <knu@idaemons.org> wrote:
At Wed, 4 Jun 2008 03:38:48 +0900,
David Flanagan wrote:
> Akinori MUSHA wrote:
> > Hi,
> >
> > Earlier today I added a new instance method named `with_memo' to
> > Enumerable::Enumerator, but I'm not 100% sure if the name fits the
> > function.
>
> What does the method do?  What's the use-case?

From rdoc:

   call-seq:
     e.with_memo(obj) {|(*args), memo_obj| ... }
     e.with_memo(obj)

   Iterates the given block for each element with an arbitrary
   object given, and returns the memo object.

   If no block is given, returns an enumerator.

I like with_memo but I'd propose to call it each_with_memo.
I could also imagine the name "each_with_state".
 
-- henon
------=_Part_9657_2829427.1212589014434--