Last active
August 29, 2015 14:06
-
-
Save waseem/d5ddff735f3e863b47a4 to your computer and use it in GitHub Desktop.
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
authors = [ | |
%{ name: "Jose", langauge: "Elixir" }, | |
%{ name: "Matz", langauge: "Ruby" }, | |
%{ name: "Larry", language: "Perl" } | |
] | |
language_with_an_r = fn (:get, collection, next_fn) -> | |
for row <- collection do | |
if String.contains?(row.language, "r") do | |
next_fn.(row) | |
end | |
end | |
end | |
get_in(authors, [langauge_with_an_r, :name]) # => ["Jose", nil, "Larry"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment