Em 27-11-2011 23:59, Nobuyoshi Nakada escreveu:
> ...
>> Anyway, I still didn't understand why (1..10).grep(&:even?) works, but (1..10).grep(&:even?){|i| i+1} not.
> The former is equivalent to
>
>    (1..10).grep {|i| i.even?}
>
> You can't pass two or more blocks to one method call.

Ah, ok, thanks. So this is actually the explanation why the other 
example won't work.

Maybe if Ruby accepted blocks as parameters, like Groovy does and as 
Jos Valim has proposed in a talk at RubyConf Brazil, that could be 
achievable as

(1..10).grep&:even?, {|i| i+1}

Has this feature already been discussed?