Last active
December 5, 2018 21:35
-
-
Save damonvjanis/ae89bf2d0065fb1b3252d1f963ef26f1 to your computer and use it in GitHub Desktop.
Uses maps to do a matching comparison on big datasets
This file contains 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
contacts = Enum.group_by(contacts, fn c -> c["email"] end) | |
for lead <- leads do | |
matching_contacts = contacts[lead["email"]] | |
if matching_contacts do | |
# Return a tuple with the lead and any contacts that match | |
{lead, matching_contacts} | |
end | |
end | |
|> Enum.filter(& &1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment