|
|
|
good chemistry is complicated, and a little bit messy -LW |
|
| PerlMonks |
Rakudo function composition problemby eklerks (Novice) |
| on Jun 03, 2010 at 13:29 UTC ( [id://842911] : perlquestion . print w/replies, xml ) | Need Help?? |
|
eklerks has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
(Update it is not an problem with operators in rakudo) (Update perl5 code fails because $f and $g aren't local in my original code, as almut points out) I was trying to create a composition operator in perl. I know it is too simple, it only accepts functions, which have 1 argument, but that isn't the problem:
It works when I make a composition of 2 functions:
When I try to composite 3 functions, it gets a bit wacky:
When I try to first assign the working case to a variable and then composite it with another function, I get an even stranger result:
I wrote it in a comparable way for javascript to see and perl5, if it was working there. <s>In perl5 it didn't work either</s> and in javascript it did: (Runned with rhino)
Failing perl5 code
Correct perl5 code
The code on rosettacode.org has the same problem. (perl6) Is this a bug, or is this something I clearly don't understand?
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||