Author: larry Date: Wed Oct 8 11:23:01 2008 New Revision: 14589 Modified: doc/trunk/design/syn/S03.pod doc/trunk/design/syn/S05.pod doc/trunk/design/syn/S13.pod
Log: various tweaks and clarifications Modified: doc/trunk/design/syn/S03.pod ============================================================================== --- doc/trunk/design/syn/S03.pod (original) +++ doc/trunk/design/syn/S03.pod Wed Oct 8 11:23:01 2008 @@ -12,9 +12,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 8 Mar 2004 - Last Modified: 5 Oct 2008 + Last Modified: 8 Oct 2008 Number: 3 - Version: 141 + Version: 142 =head1 Overview @@ -1589,11 +1589,13 @@ C<< infix:<...> >>, the series operator. This operator takes a concrete list on its left and a function to be -iterated on its right when the list must be extended. +iterated on its right when the list must be extended. Each time the +function must be called, it extends the list with the values +returned by the function (if any). The value of the operator is the lazy list formed of the concrete list followed by the result of applying the function to the -tail of the list as needed. The function indicates by its arity +tail of the list as needed. The function indicates by its signature how many of the preceding values to pay attention to (and which the operator must track internally). Demonstration of this falls to the lot of the venerable Fibonacci sequence: @@ -1616,6 +1618,15 @@ () ... &rand # list of random numbers +The function may also be slurpy (*-ary), in which case all the +preceding values are passed in (which means they must all be cached +by the operator, so performance may suffer). + +The arity of the function need not match the number of return values, but +if they do match you may interleave unrelated sequences: + + 1,1 ... { $^a + 1, $^b * 2 } # 1,1,2,2,3,4,4,8,5,16,6,32... + If the right operand is C<*> (Whatever) and the sequence is obviously arithmetic or geometric, the appropriate function is deduced: @@ -1623,7 +1634,7 @@ 1, 2, 4 ... * # powers of 2 Conjecture: other such patterns may be recognized in the future, -depending on which unrealistic benchmark we want to run faster. C<:)> +depending on which unrealistic benchmarks we want to run faster. C<:)> Note: the yada operator is recognized only where a term is expected. This operator may only be used where an infix is expected. If you @@ -1653,6 +1664,10 @@ 10,20,30,40,50,60,70,80,90, 100,200,300,400,500,600,700,800,900 +In slice context the function's return value is appended as a capture +rather than as a flattened list of values, and the argument to each +function call is the previous capture in the list. + =back Many of these operators return a list of Captures, which depending on Modified: doc/trunk/design/syn/S05.pod ============================================================================== --- doc/trunk/design/syn/S05.pod (original) +++ doc/trunk/design/syn/S05.pod Wed Oct 8 11:23:01 2008 @@ -14,9 +14,9 @@ Maintainer: Patrick Michaud <[EMAIL PROTECTED]> and Larry Wall <[EMAIL PROTECTED]> Date: 24 Jun 2002 - Last Modified: 6 Oct 2008 + Last Modified: 8 Oct 2008 Number: 5 - Version: 84 + Version: 85 This document summarizes Apocalypse 5, which is about the new regex syntax. We now try to call them I<regex> rather than "regular @@ -719,11 +719,11 @@ indicator of the abstract goal of the parser at that point. However, often this is not terribly informative, especially when rules are named according to an internal scheme that will not make sense to the user. -The C<:dba> ("doing business as") adverb may be used to set up a more informative name for +The C<:dba("doing business as")> adverb may be used to set up a more informative name for what the following code is trying to parse: token postfix:sym<[ ]> { - :dba<array subscript> + :dba('array subscript') '[' ~ ']' <expression> } Modified: doc/trunk/design/syn/S13.pod ============================================================================== --- doc/trunk/design/syn/S13.pod (original) +++ doc/trunk/design/syn/S13.pod Wed Oct 8 11:23:01 2008 @@ -12,9 +12,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 2 Nov 2004 - Last Modified: 21 Sep 2007 + Last Modified: 8 Oct 2007 Number: 13 - Version: 10 + Version: 11 =head1 Overview @@ -158,13 +158,13 @@ A class may define methods that allow it to respond as if it were a routine, array, or hash. The long forms are as follows: - method postcircumfix:<( )> (|$capture) {...} + method postcircumfix:<( )> ($capture) {...} method postcircumfix:<[ ]> (*@@slice) {...} method postcircumfix:<{ }> (*@@slice) {...} Those are a bit unwieldy, so you may also use these short forms: - method &.( |$capture ) {...} + method &.( $capture ) {...} method @.[ *@@slice ] {...} method %.{ *@@slice } {...}