On Jan 29, 2008, at 4:07 PM, "Martin DeMello"  
<martindemello / gmail.com> wrote:

> Paul Graham just released Arc (http://paulgraham.com/arc0.html), a
> lisp dialect with an emphasis on "quick-and-dirty" exploratory
> programming, and compactness of code. One of the ideas he threw in
> seems like it might fit well into Ruby too - when filtering functions
> like keep and rem (select and reject) are given a value rather than a
> function, they implicitly construct the equality function and pass
> that in instead. The ruby equivalent would be to have select, reject,
> partition, any? and all? (and possibly some others I'm overlooking) do
> the following:
>
> def select(arg, &blk)
>  if block_given?
>    old_select(&blk)
>  else
>    old_select {|x| arg === x}
>  end
> end
>
> and likewise for the others
>
> So we can write, for instance
>
> ints = input.select Integer
>
> lcase = words.reject /[A-Z]/
>
> and so on. What say you?
>
> martin

You can do that with grep.

[1, :foo].grep Fixnum
# => [1]