Skip to content

Instantly share code, notes, and snippets.

@amacgregor
Created January 17, 2016 19:39
Show Gist options
  • Save amacgregor/93b23d7260b62a0b72e5 to your computer and use it in GitHub Desktop.
Save amacgregor/93b23d7260b62a0b72e5 to your computer and use it in GitHub Desktop.
@doc """
Sums all the values inside the provided list
"""
@spec count(list) :: non_neg_integer
def count([]), do: 0
def count([_|tail]) do
count(tail) + 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment