functional programming - How to change all the values in an Elixir map -
I know that there is one in the Dick module, but a update_all
method that changes to all Values?
I tried to do it with Enum.map
but changed the type:
iex (6)> Enum.map (% {: a = & gt; 2}, fn {k, v} - & gt; {k, v + 1} end) [a: 3]
You can pipe in Enum.into (% {}}
or / Code> can be understood, ie:
iex> {k, v} and lt; -% {a: 1, b: 2}, in:% { }, Do this: {k, v + 1}% {a: 2, b: 3}
Comments
Post a Comment