That’s basically what Map.new/2
does. I don’t feel like it gets the attention it deserves, and that probably has to do with the choice/tradeoffs made in the Enum module.
1 Like
With a name like that it wouldn’t and into %{}
diverts attention from Map.new/1
.
iex(1)> i = %{a: "hello", b: "world"}
%{a: "hello", b: "world"}
iex(2)> o = Map.new(i, fn ({k,v}) -> {k,String.upcase(v)} end)
%{a: "HELLO", b: "WORLD"}
iex(3)>
1 Like