On Nov 29, 10:46=A0pm, Mike Austin <"mike[nospam]"@mike-austin.com>
wrote:
> I'm pretty sure select used to use the actual value of the called block,
> instead of treating it as just a truthy/falsey boolean. =A0I know this is
> unconventional, but it's a really nice, compact way of expressing map and
> filter in one shot, like list comprehension:
>
> (1..10).select { |a| a * a if a > 5 }
>
> Was it ever there, or did I just have a dream about it? =A0It's easy to
> implement... just wondering.

This is what I do:

(1..10).collect{ |a| a * a if a > 5 }.compact

The only time this doesn't work is when you want to preserve nils in
your original array.

-- Mark.