Skip to content

Instantly share code, notes, and snippets.

@muraiki
Last active August 29, 2015 14:14
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 muraiki/1658a29e82d941507bb5 to your computer and use it in GitHub Desktop.
Save muraiki/1658a29e82d941507bb5 to your computer and use it in GitHub Desktop.
multi+cached+subset
subset NonNegativeInt of Int where * >= 0;
proto fib (|) is cached returns NonNegativeInt {*}
multi fib (0) { 0 }
multi fib (1) { 1 }
multi fib (NonNegativeInt $n) { fib($n - 1) + fib($n - 2) }
say fib(100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment