Advertisement
Guest User

Untitled

a guest
Feb 7th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. #!/usr/bin/env perl6
  2.  
  3. multi sub fib (Int $n where * == 1) is cached { 1}
  4. multi sub fib (Int $n where * == 2) is cached { 1}
  5. multi sub fib (Int $n where * >= 3) is cached { fib($n - 1)
  6. + fib($n - 2)}
  7. say fib(17);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement