[I'm not on the list; please CC.]
In Scheme, I can say:
(cond
((predicate-expression) => (lambda (r) ...))
(...))
... and the value returned by (predicate-expression) is passed as an
argument to the lambda expression in the rhs. Sometimes this is very
handy, since then I don't have to call on (predicate-expression)
again, or create a (let ...) around it all to cause
(predicate-expression) to only be computed once!
I'd like to do the similar in Perl 6, where, for instance:
if ($self->{obsoletes})
{
foreach (@{$self->{obsoletes}})
{
# do something with this $_
}
}
... could become something more like:
if ($self->{obsoletes}) =>
{
# $_ is now the value of "$self->{obsoletes}" as returned
# above, never computed (or typed in) twice.
#
foreach (@{$_}})
{
# do something with this inner $_
}
}
Do you like that syntax? Is it doable or right? Anyway, you decide
that part, if you like the idea, or have already thought of it.
--
No, one more time, I do NOT need your "leadership", sir.
Please just GET OUT OF MY WAY. .''`.
Debian -- The blue collar Linux distribution. : :' :
<URL:http://www.debian.org/social_contract> `. `'