Skip to content

Instantly share code, notes, and snippets.

@muraiki
Last active Aug 29, 2015
Embed
What would you like to do?
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