From: ara.t.howard@... Date: 2006-12-14T08:22:51+09:00 Subject: Re: map taking an argument (was: Re: join_with) On Thu, 14 Dec 2006 dblack@wobblini.net wrote: > Hi -- > > On Thu, 14 Dec 2006, Christian Neukirchen wrote: > >> "Martin DeMello" writes: >> >>>> (1..10).map &lambda {|i| i*2} >>> => [2, 4, 6, 8, 10, 12, 14, 16, 18, 20] >> >> David, do you want to allow (1..10).map(:*, 2) ? > > I don't particularly want to allow map(:anything) :-) I was just > somewhat surprised to see the idea return in a slightly new form, > since Matz had rejected it a while ago. > > If I were designing map(:name), I don't think I'd want it to take > arguments. But I have no technical grounds for saying so, only > aesthetic ones. you confound me david! ;-) if you like 'e.map :m' how can you __not__ like harp:~ > cat a.rb class Array def map *a, &b m, *a = *a super &(b || lambda{|o| o.send m, *a}) end end prefixes = %w( foo-bar bar-foo ).map :[], /^\w+/ p prefixes harp:~ > ruby a.rb ["foo", "bar"] ? -a -- if you find yourself slandering anybody, first imagine that your mouth is filled with excrement. it will break you of the habit quickly enough. - the dalai lama