From: Rodrigo Rosenfeld Rosas Date: 2011-11-28T10:05:55+09:00 Subject: [ruby-core:41341] Re: [ruby-trunk - Feature #5663] Combined map/select method Em 25-11-2011 01:00, Nobuyoshi Nakada escreveu: > Issue #5663 has been updated by Nobuyoshi Nakada. > > > Rodrigo Rosenfeld Rosas wrote: >> Nobuyoshi, wouldn't&:even? be equivalent to :even?.to_proc? I just find that the example reads better this way ;) > They are different. > &expr calls #to_proc method on the result of expr, to achieve a Proc object. > >> (1..10).grep(&:even?){|i|i+1} > It's a syntax error. Wow! Thanks! This is unexpected to me. I didn't know about the difference. Anyway, I still didn't understand why (1..10).grep(&:even?) works, but (1..10).grep(&:even?){|i| i+1} not. Actually, I didn't understand your explanation. You said that &expr calls #to_proc on the result of expr. What is the expr on each example? Is there any place I could further read about those differences? Thank you, Rodrigo.