So, in Perl 6, by the time it gets into the first set of curlies { my ... }, $n is already a copy of the argument passed in to addn() and not simply an alias?sub addn($n) { my $retsub = sub ($x) { $x + $n } return $retsub; }
I'm curious. Thanks.sub addn($n) { my $m = $n; my $retsub = sub ($x) { $x + $m } return $retsub; }
In reply to Re: A Romp Around addn
by repellent
in thread A Romp Around addn
by John M. Dlugosz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |