Nathaniel Talbott
10/7/2003 1:11:00 AM
nobu.nokada@softhome.net [mailto:nobu.nokada@softhome.net] wrote:
> > Inject works on pairs of elements. Since your list has only one
> > element, there are no pairs.
>
> It's correct, the code has no iteration.
Ah, good point. Missed that.
> > You can force one pair in the above example by explicitly
> supplying an
> > initial element ...
> >
> > ['a'].inject(''){break 'b'} # => 'b'
>
> But this doesn't work as Nathaniel expected. It returns last
> iteration value, "".
Well, at least I was partly right about it not working :-).
Thanks, Jim & Nobu.
Nathaniel
<:((><