In message "[ruby-talk:24738] Re: Negate grep pattern match?"
on Fri, 9 Nov 2001 14:21:23 +0900,
OZAWA -Crouton- Sakuro <crouton / weatherlight.org> writes:
> grep(pat)
> and grep(pat) block
>
> should be considered to be shortcuts for
>
> select{|item| pat==item }
> and select{|item| if pat==item then block(item); true; else false; end }
>
> respectively.
I found typo:
select{|item| pat===item }
and select{|item| if pat===item then block(item); true; else false; end }
E.g.,
p [1,30,100,57].grep(10..90) #=> [30, 57]
p [1, "a", :foo, []].grep(String) #=> ["a"]
-- Gotoken