Created
April 27, 2016 17:04
-
-
Save brweber2/426512c59fb12efbbcae81fc5576650c to your computer and use it in GitHub Desktop.
This file contains 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
def ex2(characters, type), do: ex2h(characters, type, []) | |
def ex2h([head = %{type: type} | tail], type, result) do | |
ex2h(tail, type, [head | result]) | |
end | |
def ex2h([head | tail], type, result), do: ex2h(tail, type, result) | |
def ex2h([], _type, result), do: Enum.reverse(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment