James Gray
7/9/2006 2:33:00 PM
On Jul 9, 2006, at 9:03 AM, dblack@wobblini.net wrote:
> Hi --
>
> Can someone jog my memory, and/or enlighten me, as to what a case
> would be where it's useful to have:
>
> array.map
>
> return an Enumerator? I can't seem to come up with an example where:
>
> array.map.anything
>
> is different from
>
> array.anything
>
> Thanks --
Well, you can use it to roll the oft-requested map_with_index():
array.each_with_index.map { |obj, i| .. }
That's not a map() example though, so maybe not what you wanted.
James Edward Gray II