Skip to content

Instantly share code, notes, and snippets.

@thiagofm
Created April 27, 2013 16:12
Show Gist options
  • Select an option

  • Save thiagofm/5473623 to your computer and use it in GitHub Desktop.

Select an option

Save thiagofm/5473623 to your computer and use it in GitHub Desktop.
filter(_, [], List) -> List;
filter(F, [H|T], List) ->
case F(T) of
true -> filter(F, [T], [H|List]);
false -> filter(F, [T], List)
end.
%% why can't I do this way?
filter(_, [], List) -> List;
filter(F, [H|T], List) ->
if F(T) =:= true -> filter(F, [T], [H|List]);
true -> filter(F, [T], List)
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment