Skip to content

Instantly share code, notes, and snippets.

@TimToady
Created May 30, 2012 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TimToady/2837838 to your computer and use it in GitHub Desktop.
Save TimToady/2837838 to your computer and use it in GitHub Desktop.
sub fibo ($n) {
constant @starters = 1,1,2,4 ... *;
nacci @starters[^$n];
}
sub nacci (*@starter) {
my &fun = eval join '+', '*' xx @starter;
@starter, &fun ... *;
}
for 2..10 -> $n { say fibo($n)[^20] }
say nacci(2,1)[^20];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment