From: "David A. Black" Date: 2005-07-11T19:48:06+09:00 Subject: Re: accessing index inside map --927295978-1400029014-1121078856=:1059 Content-Type: MULTIPART/MIXED; BOUNDARY="927295978-1400029014-1121078856=:1059" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --927295978-1400029014-1121078856=:1059 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Hi -- On Mon, 11 Jul 2005, [iso-8859-1] "Pe=F1a, Botp" wrote: > OK, i'll be shooting for the moon here. How about passing a parameter? Is= it > then possible to make #each or #map same behavior w #each_with_index or > #map_with_index or whatever *_with_index so that the ff works, > > def each(with_index=3Dtrue) do... end > > def map(with_index=3Dtrue) do ... end > > and thus, we can do > > [1,2,3,4,5,6].map(true) {|x,i|[2,5].include?(i) ? x : x*2} I'd hope not to see that. I'm actually hoping that maybe someday all the boolean flag methods (like instance_methods(true) etc.) will be changed :-) They've always seemed to me to be the most cryptic thing in all of Ruby. David --=20 David A. Black dblack@wobblini.net --927295978-1400029014-1121078856=:1059-- --927295978-1400029014-1121078856=:1059--