Created
October 6, 2012 21:05
-
-
Save timbunce/3846125 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@xyz»++ # increment all elements of @xyz | |
@x = @a »min« @b # @x is smallest of @a and @b | |
$mean = ([+] @a) / @a # calculate mean of @a | |
$sumsq = [+] (@x »**» 2) # sum of squares of @x | |
$fact = [*] 1..$n # $n factorial | |
sub postfix:<!> { [*] 1..$^n } # define new operator | |
say 5!; # 120 | |
@odd = 1,3 ... * # odd numbers (lazy & infinite) | |
@fib = 1,1 ... &[+] # the entire Fibonacci sequence |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment