Author: moritz
Date: 2009-08-21 12:49:04 +0200 (Fri, 21 Aug 2009)
New Revision: 28043
Modified:
docs/Perl6/Spec/S02-bits.pod
Log:
[S02] small clarifications on Whatever comprehensions
Modified: docs/Perl6/Spec/S02-bits.pod
===================================================================
--- docs/Perl6/Spec/S02-bits.pod 2009-08-20 17:45:03 UTC (rev 28042)
+++ docs/Perl6/Spec/S02-bits.pod 2009-08-21 10:49:04 UTC (rev 28043)
@@ -827,7 +827,7 @@
* - 1
-produces a function of a single argument:
+produces a closure of a single argument:
{ $_ - 1 }
@@ -836,13 +836,18 @@
@primes = grep *.prime, 2..*;
+If multiple C<*> appear as terms within a single expression, the resulting
+closure binds them all to the same argument, so C<* * *> translates to
+C<{ $_ * $_ }>.
+
These closures are of type C<Code:($)>, not C<Whatever>, so that constructs
can distinguish
via multiple dispatch:
1,2,3 ... *
1,2,3 ... *+1
-The bare C<*> form may also be called as a function, and represents the
identify function:
+A bare C<*> which is immediately followed by a C<(...)> or C<.(...)> is parsed
+as the unary identity closure:
*(42) == 42
(* + 1)(42) == 43