From: Robert Klemme Date: 2008-10-02T00:53:31+09:00 Subject: Re: Mode method for Array 2008/10/1 David A. Black : >> In that case #map might be more appropriate - at least if the target >> collection is an Array. Btw, did we ever discuss having #map accept a >> parameter which defaults to []? i.e. >> >> module Enumerable >> def map(target = []) >> each {|x| target << yield x} >> target >> end >> end > > I don't think it's a good idea; it generalizes the idea of a mapping > of a collection beyond anything that really seems to me to be a > mapping. If I saw: > > [1,2,3,4,5] => "Hi." > > I would not just say it's a weird mapping; I would not be able to > identify it as a mapping at all. It's a more general transformation. I'm not sure I understand exactly what you mean. My point was simply to allow the caller to provide the target collection where something is mapped to. Of course you can then also use a String or anything else that supports << (a stream for example) which I find quite neat. But where does "=>" syntax come into play? Kind regards robert -- remember.guy do |as, often| as.you_can - without end