Hello,

There is Map.get/3 already, how would this differ?

Best

Adam

On Tue, 26 Jan 2021 at 08:38, Paweł Urbanek <[email protected]>
wrote:

>
> 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
> <https://groups.google.com/d/msgid/elixir-lang-core/616a2726-740d-4b10-a02c-2a0c4e195a2fn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CADwgC_D4Nh1nubRySyVt2yQGsYUXtbwiGoZ5GgFU3AU%3DKVLRqw%40mail.gmail.com.

Reply via email to