langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
10
Task/Anonymous-recursion/Perl-6/anonymous-recursion-1.pl6
Normal file
10
Task/Anonymous-recursion/Perl-6/anonymous-recursion-1.pl6
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
sub fib($n) {
|
||||
die "Naughty fib" if $n < 0;
|
||||
return {
|
||||
$_ < 2
|
||||
?? $_
|
||||
!! &?BLOCK($_-1) + &?BLOCK($_-2);
|
||||
}($n);
|
||||
}
|
||||
|
||||
say fib(10);
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
constant @fib = 0, 1, *+* ... *;
|
||||
say @fib[10];
|
||||
Loading…
Add table
Add a link
Reference in a new issue