Skip to content

Instantly share code, notes, and snippets.

@bdotdub
Created February 25, 2009 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bdotdub/70317 to your computer and use it in GitHub Desktop.
Save bdotdub/70317 to your computer and use it in GitHub Desktop.
Equivalent?
filter(P, [H|T]) ->
case P(H) of
true -> [H|filter(P, T)];
false -> filter(P, T)
end;
filter(P, []) ->
[].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
filter(P, [H|T]) when P(H) = true ->
[H|filter(P, T)];
filter(P, [H|T]) when P(H) = false ->
filter(P, T);
filter(P, []) ->
[].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment