Skip to content

Instantly share code, notes, and snippets.

@elbrujohalcon
Created June 21, 2016 03:36
Show Gist options
  • Save elbrujohalcon/e323a45291de09f59fc6a5ea387ad759 to your computer and use it in GitHub Desktop.
Save elbrujohalcon/e323a45291de09f59fc6a5ea387ad759 to your computer and use it in GitHub Desktop.
people:count/2 for my blog post
-spec count(country(), [group()]) -> non_neg_integer().
count(Country, Groups) ->
lists:sum(
lists:map(
fun (#{country := Country, members := Members}) ->
length(Members);
(_) ->
0
end, Groups)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment