In Elixir, what would be an efficient way to filter a Map by its values.
Map
Right now I have the following solution
%{foo: \"bar\", biz: ni
You can also write like this:
m = %{foo: "bar", biz: nil, baz: 4} Enum.reduce(m, m, fn {key, nil}, acc -> Map.delete(acc, key) {_, _}, acc -> acc end)
The code above is quite efficient if there are few nil values in m.
nil
m