I was working on some code that would simply test if one key was in a map
and return it's value, and otherwise return a different key's value.
The map had a form like the following:
%{
oncall: "dlong",
overrideoncall: "jsmith",
...
}
If there was someone overriding on call then their name would be in the `
overrideoncall` key, otherwise the key would not be in the map.
I think this could be a nice use for `Map.get_lazy`, if the function had
the original map passed in, allowing me to write the code as follows:
Map.get_lazy(on_call_group, :overrideoncall, &(&1[:oncall]))
Before I wrote a pull request, I thought I'd see if this is a feature that
makes sense to others?
--
You received this message because you are subscribed to the Google Groups
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elixir-lang-core/719dc4fc-ae23-4437-b059-d91356e9b43b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.