On Sat, May 14, 2005 at 10:53:38PM +0800, Autrijus Tang wrote:
: On Sat, May 14, 2005 at 10:56:29PM +1000, Damian Conway wrote:
: >     8. To verify the monotonicity of a sequence:
: > 
: >            $is_monotonic = [<] @numbers;
: 
: Hey.  Does this mean that the [] metaoperator folds with the
: associativity of the operator inside it?

Yes.  It's as if there is a long cat, only without the cat.

: That is, if the operator inside is right-associative, it functions as
: foldr; if the operator is left-associative, it functions as a foldl; and
: if the operator is chain-associative like <, it assumes the special,
: short-circuiting chained-folding semantic?
: 
:     [>]  1, 2, 3;    # 1 > 2 > 3      # 3 is not evaluated
:     [**] 1, 2, 3;    # 1 ** (2 ** 3)
:     [+]  1, 2, 3;    # (1 + 2) + 3
: 
: If so, should I send patches to S03, or is it already in the works?

Feel free, unless someone else volunteers.

: Finally, what does this mean?
: 
:     say [x];
: 
: Is it a repeating metaoperator on an empty list, or a single-element
: array reference that contains the return value of calling &x()?

Always the first.  [x] doesn't have to do lookahead.

Larry

Reply via email to