To do the equivalent of Python list comprehensions, I\'m doing the following:
some_array.select{|x| x % 2 == 0 }.collect{|x| x * 3}
Is ther
I've just published the comprehend gem to RubyGems, which lets you do this:
require 'comprehend' some_array.comprehend{ |x| x * 3 if x % 2 == 0 }
It's written in C; the array is only traversed once.