Lambdas part 2
... but in Perl 6 TMTOWTDI
# Python:
g = lambda x: x + 2
# Perl 6:
$g = -> $x { $x + 2 }
$g = { $^x + 2 }
$g = * + 2
| Python and Perl 6 | Similarities between Python and Perl 6 | #24 |
... but in Perl 6 TMTOWTDI
# Python:
g = lambda x: x + 2
# Perl 6:
$g = -> $x { $x + 2 }
$g = { $^x + 2 }
$g = * + 2
|
Copyright © 2010 http://www.pmichaud.com/2010/pres/ |