Skip to content

Instantly share code, notes, and snippets.

@dskecse
Last active October 12, 2015 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dskecse/54ebc9cfa3f606d7ae66 to your computer and use it in GitHub Desktop.
Save dskecse/54ebc9cfa3f606d7ae66 to your computer and use it in GitHub Desktop.
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