Skip to content

Instantly share code, notes, and snippets.

Created October 2, 2009 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/200009 to your computer and use it in GitHub Desktop.
Save anonymous/200009 to your computer and use it in GitHub Desktop.
module(elementcount).
export([elementcount/2]).
elementcount(Key, List) ->
lists:foldl(fun(X, Acc) ->
case X =:= Key of
true ->
Acc + 1;
false ->
Acc
end
end,
0, List).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment