Skip to content

Instantly share code, notes, and snippets.

@RobertFischer
Last active March 6, 2018 14:07
Show Gist options
  • Save RobertFischer/f682707b71c87d02df086c214b126a7e to your computer and use it in GitHub Desktop.
Save RobertFischer/f682707b71c87d02df086c214b126a7e to your computer and use it in GitHub Desktop.
Haskell fib
fib :: Int -> Int
fib 0 = 0
fib 1 = 1
fib 2 = 2
fib i | i < 0 = error "argument to fib must be > 0"
fib i = fib (i-1) + fib (i-2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment