--90e6ba5bb8d943d4c0049d223742 Content-Type: text/plain; charset=UTF-8 On Fri, Feb 25, 2011 at 9:15 PM, Jarmo Pertman <jarmo.p / gmail.com> wrote: > It's still whopping 12 characters longer. So i decided to use > different block variable - more Scala-like underscore: > sales.select{|_| _.value > 50000}.map(&:buyer).sort_by(&:age) > > Still 6 characters longer. Even if i'd be able to use syntax like > this, i'd win only 2 characters: > What's the point of this exercise? Why is "beating" Scala's solution the same as getting it shorter? The original Ruby code and Scala's are equally readable. Contrast their readability to the lambdaj code you gave, and there's no more to do. Both beat lambdaj without any greater expenditure of effort required. Hacking things apart and introducing instance_eval selects is worse than using character length! That said, this does appeal to me: array.select { &:value > 5 } Perhaps something could be done with the singleton of the proc resulting from Symbol#to_proc, to pass method calls to the block parameter. But then perhaps that's just ugly. --90e6ba5bb8d943d4c0049d223742--