# perl6

sub fib (int $n –> int) {

$n < 2 ?? $n !! fib($n-1) + fib($n-2)

}

say fib 30; # 2.83s

# perl6

sub fib ($n) {

$n < 2 ?? $n !! fib($n-1) + fib($n-2)

}

say fib 30; # 8.87s

# perl5

sub fib {

my $n = shift;

$n < 2 ? $n : fib($n-1) + fib($n-2)

}

print fib 30; # 1.7s

]]>`[+]`

means reduce a list using addition, as you think. `&[+]`

is just a shortcut for naming the infix addition operator. Personally, though, I find `&[+]`

somewhat confusing and never use it.
]]>1, 1, &[+] … * # fibonacci sequence

Why is this? Have I guessed wrong that &[+] means the same as -> (*@arr) { [+] @arr } maybe? Because if that’s what it means, doesn’t it sum over all preceding terms? That would work out to 1, 1, 2, 4, 8, … * rather than fibonacci.

]]>(inspired by “The Grinch” ([http://www.amazon.com/Grinch-Stole-Christmas-Classic-Seuss/dp/0394800796/ref=sr_1_1?s=books&ie=UTF8&qid=1419640443&sr=1-1&keywords=The+grinch], maybe a post modern version of “The Christmas Carol” [ http://www.amazon.com/Christmas-Carol-Charles-Dickens/dp/1503212831/ref=sr_1_2?s=books&ie=UTF8&qid=1419640511&sr=1-2&keywords=The+christmas+carol ] ).

This little who for one will be singing along with Tiny Tim (Toady), “God bless Us, Every One! “

]]>What happens if your parameter as an integer “2” ? ]]>

This is perl6 version 2014.09 built on MoarVM version 2014.09

]]>