On Tue, 26 Nov 2002 02:13 pm, Yukihiro Matsumoto wrote:
> These ideas are proposed several times.  But no one ever succeeded to
> persuade me to add these.  Do you think of any concrete usage of these
> methods, not just for seeking completeness?

I gave one example in another thread, which was the example that I ran into 
that caused me to bring this up in the first place.

To take a string, split it into paragraphs, turn each of them into an HTML <p> 
and number them:

i = 0
string.split("\n").collect{ |s| '<p>' + (i += 1).to_s + " - " + s }.join("\n")

could be better written as:

string.split("\n").collect_with_index{ |i, s| '<p>' + i.to_s + " - " + s 
}.join("\n")

removing the need for the external 'i' variable. However, is seeking 
completeness such a horrible thing? We have an each_with_index, and the 
parallels between each and collect are enough that one might expect there to 
be an equivalent for collect.

Tim Bates
-- 
tim / bates.id.au