Skip to content

Instantly share code, notes, and snippets.

@thluiz
Created February 2, 2015 09:45
Show Gist options
  • Save thluiz/dedaec5c5faba40b3a7b to your computer and use it in GitHub Desktop.
Save thluiz/dedaec5c5faba40b3a7b to your computer and use it in GitHub Desktop.
The simplest fibonacci implementation
defmodule Fibonacci do
def calc(0), do: 1
def calc(1), do: 1
def calc(n) when n > 0, do: calc(n-2) + calc(n-1)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment