Garrett Goebel wrote:
> grep { ref($a) eq ref($b) } @b) # Same type?
> grep { $a == $_ } @b)
> grep { $a eq $_ } @b)
> grep { $a > $_ } @b)
>
> Garrett
grep doesn't short-circuit; you can't return or exit or last out
of the thing.
Maybe we could add support for C<last> to C<grep> and C<map>: that
would allow a shorter C<in> function without losing any flexibility.
grep { ref($a) eq ref($b) and last } @b) # Same type?
grep { $a == $_ and last } @b)
grep { $a eq $_ and last } @b)
grep { $a > $_ and last } @b)
The RFC 88 lazy would work too, you can pull off the first grepped
value and if you don't go back for another the thing will get dismantled
when the current scope closes.
--
David Nicol 816.235.1187 [EMAIL PROTECTED]
perl -e'@w=<>;for(;;){sleep print[rand@w]}' /usr/dict/words