I'd like to propose extending the API for Keyword and Map, fetch! method:
Map.fetch!(%{a: 1}, :b, 2) => 2
Keyword.fetch!([a: 1], :b, 2) => 2
Third argument represents value which will be returned in case the
requested key is missing. Optionally maybe it could also accept the
function which is executed only in case the key is missing and it's return
value is used.
It would allow a simple way to fallback to default option values.
--
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/616a2726-740d-4b10-a02c-2a0c4e195a2fn%40googlegroups.com.