Skip to content

Instantly share code, notes, and snippets.

@guipdutra
Created July 4, 2013 23:24
Show Gist options
  • Save guipdutra/5930803 to your computer and use it in GitHub Desktop.
Save guipdutra/5930803 to your computer and use it in GitHub Desktop.
defmodule Mylist do
def filter([], func, f_array), do: f_array
def filter([head|tail], func, f_array // []) do
if func.(head) do
filter(tail, func, List.concat(f_array , [head]))
else
filter(tail, func, List.concat(f_array , []))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment