Hi --

On Tue, 26 Nov 2002, Gavin Sinclair wrote:

>
> From: "Bulat Ziganshin" <bulatz / integ.ru>
>
> > some suggestions for ruby:
> >
> > 1. list comprehension
> >
> > { |x<-0...n| x*2 }
> > { |n, x<-0...n, y<-0..x| [x,y] }
> >
> > 2. default argument name to block/method
> >
> > map {_*2}  list  # same as map {|x| x*2} list
> > map {_.lc} list  # same as map {|x| x.lc} list
> > def x2 => _*2    # def x2(x); x*2; end
>
>

> I proposed both of these 2-3 months ago and they were not popular.
> I would now *not* propose the first one - it is rather obfuscated.
> In its place I would propose Enumerable#mapf (/#collectf) ("map
> function").  Your first example couldn't be done using it, but the
> second one would be
>      list.mapf(:lc)

That's been proposed and rejected; see
http://www.rubygarden.org/article.php?sid=127.  Matz's comment was:


  It's too functional so that I'm afraid it would not work well with
  OO nature of Ruby. Maybe it's matter of notation.


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav