From: "David A. Black" Date: 2008-12-02T17:59:19+09:00 Subject: Re: Enumerable#select used to return actual values --1926193751-1932689729-1228208689=:25430 Content-Type: MULTIPART/MIXED; BOUNDARY="1926193751-1932689729-1228208689=:25430" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1926193751-1932689729-1228208689=:25430 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Hi -- On Tue, 2 Dec 2008, Pe=F1a, Botp wrote: > 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 selectio= n 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] I don't see that method in 1.9. Which version are you using? David --=20 Rails training from David A. Black and Ruby Power and Light: INTRO TO RAILS (Jan 12-15), Fort Lauderdale, FL See http://www.rubypal.com for details Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2) --1926193751-1932689729-1228208689=:25430-- --1926193751-1932689729-1228208689=:25430--