Author: moritz Date: 2009-05-18 23:08:54 +0200 (Mon, 18 May 2009) New Revision: 26876
Modified: docs/Perl6/Spec/S02-bits.pod docs/Perl6/Spec/S09-data.pod Log: [S02] get rid of the each() comprehension [S09] document speculative each() junction with grep semantics Modified: docs/Perl6/Spec/S02-bits.pod =================================================================== --- docs/Perl6/Spec/S02-bits.pod 2009-05-18 18:22:24 UTC (rev 26875) +++ docs/Perl6/Spec/S02-bits.pod 2009-05-18 21:08:54 UTC (rev 26876) @@ -3564,32 +3564,6 @@ =item * -When evaluating chained operators, if an C<each()> occurs anywhere in that -chain, the chain will be transformed first into a C<grep>. That is, - - for 0 <= each(@x) < all(@y) {...} - -becomes - - for @x.grep:{ 0 <= $_ < all(@y) } {...} - -Because of this, the original ordering C<@x> is guaranteed to be -preserved in the returned list, and duplicate elements in C<@x> are -preserved as well. In particular, - - @result = each(@x) ~~ {...}; - -is equivalent to - - @result = @x.grep:{...}; - -However, this I<each() comprehension> is strictly a syntactic transformation, -so a list computed any other way will not trigger the rewrite: - - @result = (@x = each(@y)) ~~ {...}; # not a comprehension - -=item * - The C<|> prefix operator may be used to force "capture" context on its argument and I<also> defeat any scalar argument checking imposed by subroutine signature declarations. Any resulting list arguments are Modified: docs/Perl6/Spec/S09-data.pod =================================================================== --- docs/Perl6/Spec/S09-data.pod 2009-05-18 18:22:24 UTC (rev 26875) +++ docs/Perl6/Spec/S09-data.pod 2009-05-18 21:08:54 UTC (rev 26876) @@ -1057,6 +1057,18 @@ please limit use of junctions to situations where the eventual binding to a scalar formal parameter is clear. +(Conjucture: in post-Perl 6.0.0 we might introduce an C<each()> +junction which keeps track of its initial values, returning on collapse +those initial values which transformed into a true value, for example + + each(2, 3, 4) - 3 + +would return an unordered collection consisting of 2 and 4, because +C<2-3> and C<4-3> are True in boolean context, while C<3-3> is False. +However it is not yet clear if we really want that, and if yes, in which +context the collapse will occur). + + =head1 Parallelized parameters and autothreading Within the scope of a C<use autoindex> pragma (or equivalent, such as