From: "Peña, Botp" Date: 2008-12-02T11:00:59+09:00 Subject: Re: Enumerable#select used to return actual values From: Mike Austin [mailto:"mike[nospam]"@mike-austin.com] .. # (1..10).select { |a| a * a if a > 5 } the difficulty there is that there is no clear separation bw the selection logic and the mapping logic # Was it ever there, or did I just have a dream about it? # It's easy to implement... just wondering. it's easy in 1.9.. >p (0..10).select_with_map ->(x){x<5}, ->(x){x*x} [0, 1, 4, 9, 16] one could also do partitioning if 3rd block is provided (wc catches the else portion) >p (0..10).select_with_map ->(x){x<5}, ->(x){x*x}, ->(x){x+x} [[0, 1, 4, 9, 16], [10, 12, 14, 16, 18, 20]] but still i prefer {|x| x<5} over ->(x){x<5} or maybe, ->{|x| x<5} over ->(x){x<5}