Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

grep EXPR, LIST

7 views
Skip to first unread message

John Williams

unread,
Aug 2, 2003, 11:53:07 PM8/2/03
to perl6-l...@perl.org
Perl5 map and grep allow the first argument to be an expression which is
passed to the function instead of being evaluated. (Sort of a bare block.)
What does the signature for this look like? Is it done with "is parsed"
tricks, or will perl6 require the "map BLOCK LIST" syntax?

I was recently bit by the BLOCK/hashref-EXPR ambiguity here, but maybe
that won't happen as often if hashrefs are required to use => instead of
comma.

~ John Williams


Larry Wall

unread,
Aug 3, 2003, 12:12:22 AM8/3/03
to perl6-l...@perl.org
On Sat, Aug 02, 2003 at 09:53:07PM -0600, John Williams wrote:
: Perl5 map and grep allow the first argument to be an expression which is

: passed to the function instead of being evaluated. (Sort of a bare block.)
: What does the signature for this look like? Is it done with "is parsed"
: tricks, or will perl6 require the "map BLOCK LIST" syntax?

A closure is required as the first argument for map, I think. On the
other hand, grep could be generalized to anything that can smart match,
since it's just looking for a boolean. But if you're going to use any
kind of placeholder (including $_), there has to be a closure.

Larry

0 new messages