Skip to content

Instantly share code, notes, and snippets.

@daleharvey
Forked from anonymous/gist:200009
Created October 2, 2009 19:08
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 daleharvey/200012 to your computer and use it in GitHub Desktop.
Save daleharvey/200012 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