Skip to content

Instantly share code, notes, and snippets.

@kaveet
Last active November 15, 2016 01:46
Show Gist options
  • Save kaveet/924cd0991f320d2195c6823940175725 to your computer and use it in GitHub Desktop.
Save kaveet/924cd0991f320d2195c6823940175725 to your computer and use it in GitHub Desktop.
-- fibonacci.hs
-- credit dtb@stackoverflow http://stackoverflow.com/a/1105840
-- Accessing the n-th fibonacci number: fib n = fibs !! n
module Fibonacci where
fib :: Integer -> Integer
fib 0 = 1
fib 1 = 1
fib n = fib (n-1) + fib (n-2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment