I the Dave Thomas book there is a problem which is related to pattern matching and it’s done using for loop. Is there any way we can write it using “Recursion”?
defmodule Maps do
people = [
%{name: "Grumpy", height: 1.24},
%{name: "Dave", height: 1.88},
%{name: "Dopey", height: 1.32},
%{name: "Shaquille", height: 2.16},
%{name: "Sneezy", height: 1.28}
]
IO.inspect(for person = %{height: height} <- people, height > 1.5, do: person)
end