Created
April 24, 2017 12:48
-
-
Save shahryarjb/504ee6f17df91a1d91b59015997fcbc7 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
# my blog : https://trangell.com/fa/ | |
# public : http://iranonrails.ir | |
authors = [ | |
%{ name: "José", language: "Elixir" }, | |
%{ name: "Matz", language: "Ruby" }, | |
%{ name: "Larry", language: "Perl" } | |
] | |
languages_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 | |
IO.inspect get_in(authors, [languages_with_an_r, :name]) | |
#=> [ "José", nil, "Larry" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment