Skip to content

Instantly share code, notes, and snippets.

@Tyralion
Created March 4, 2016 12:46
Show Gist options
  • Select an option

  • Save Tyralion/3dd8694673748639f2ab to your computer and use it in GitHub Desktop.

Select an option

Save Tyralion/3dd8694673748639f2ab to your computer and use it in GitHub Desktop.
fibonacci :: Integer -> Integer
fibonacci n | n < 0 = ((-1) ^ (-n+1)) * fibonacci(-n)
| n == 0 = 0
| n == 1 = 1
| n > 0 = fibonacci(n - 1) + fibonacci(n - 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment