Created
June 21, 2016 03:36
-
-
Save elbrujohalcon/e323a45291de09f59fc6a5ea387ad759 to your computer and use it in GitHub Desktop.
people:count/2 for my blog post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-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