Created
March 19, 2020 09:22
-
-
Save houmanka/9bae548978f8226ae6ffad9af06fa7e6 to your computer and use it in GitHub Desktop.
Counter with no Enum
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 AncientEgyptianMultiplication do | |
def count_of([_head | tail]) do | |
count_of(tail, 1) | |
end | |
def count_of([], state), do: state | |
def count_of([_head | tail], state) do | |
count_of(tail, state + 1) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment