Last active
October 12, 2015 12:59
-
-
Save dskecse/54ebc9cfa3f606d7ae66 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Recursive do | |
def len([]), do: 0 | |
def len([_head | tail]), do: 1 + len(tail) | |
end | |
IO.puts Recursive.len([1, 2, 3]) | |
# => 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment