> > $root->traverse( $sum += __ );
>
> There's a syntactic ambiguity here. I assumed that __ "poisons" an
> expression so that an entire parse tree gets transformed into a
> closure. If you isolate the parse tree based on expression precedence,
> then I'm not sure why the += example works.
Sorry, I finally found a moment to sit down and clarify this point.
The error was not here but in:
__ < 2 + __ * atan($pi/__) or die __
That should of course have been:
__ < 2 + __ * atan2($pi, __) or die __
(I meant to write it that way, but my brain has a mind of its own sometimes!)
A __ only "poisons" an expression/sub call if it is a direct operand/argument.
So:
atan($pi/__)
is:
atan( sub{$pi/$_[0]} );
whereas:
atan2($pi,__)
is:
sub{ atan2($pi,$_[0]) };
I'll make it clearer in version 2 of the RFC.
Damian
- RFC 23 (v1) Higher order functions Perl6 RFC Librarian
- Re: RFC 23 (v1) Higher order functions Ken Fox
- Re: RFC 23 (v1) Higher order functions Jeremy Howard
- Re: RFC 23 (v1) Higher order functions Ken Fox
- Re: RFC 23 (v1) Higher order function... Jeremy Howard
- Re: RFC 23 (v1) Higher order functions Damian Conway
- Re: RFC 23 (v1) Higher order functions John Porter
- Re: RFC 23 (v1) Higher order functions Damian Conway
- Re: RFC 23 (v1) Higher order functions Jeremy Howard
- Re: RFC 23 (v1) Higher order functions Glenn Linderman
- Different higher-order func notation? (was Re: RF... Damian Conway
- Different higher-order func notation? (was Re... Nathan Wiger
- Re: Different higher-order func notation?... Jeremy Howard
- Re: Different higher-order func notat... Mike Pastore
- Re: Different higher-order func ... Nathan Wiger
- Re: Different higher-order f... Jeremy Howard
- Re: Different higher-ord... John Porter
- Re: Different higher-order f... Damian Conway
- Re: Different higher-order f... Mike Pastore
- Re: Different higher-order f... John Porter
- Re: Different higher-order func ... Ken Fox
