The issue is that we don't have a update/3 function. So should we add
Map.update/3, Keyword.update/3 as well as Keyword.update_values/3?

The issue though is that I don't fully recall which semantics we wanted for
Keyword.update/3. Does it return a data structure? Or does it return
:ok/:error? What happens if the value does not exist in the data-structure?
Do we invoke the function with nil, mirroring get_and_update, or we don't
invoke the anonymous function at all?

How does our choice mirror other functions such as Keyword.update/4 and
Keyword.update!/3?



*José Valimwww.plataformatec.com.br
<http://www.plataformatec.com.br/>Founder and Director of R&D*

On Fri, Apr 13, 2018 at 4:40 PM, <[email protected]> wrote:

> In a little sandbox project I wanted to update all the values associated
> to a key in a keyword and I haven't found a function in the Keyword module
> so I implemented it with the following specification:
>
> @spec update_values(t, key, (value -> value)) :: t
>
> If you think it'd be added to the module, I'll do a PR with the code.
>
> --
> 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/62683691-c36c-4c2c-977e-
> 55232e24c346%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/62683691-c36c-4c2c-977e-55232e24c346%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAGnRm4KbnZkWWVtDFj_JpCdwaHOhdWL2FEP9BxtTZE7aXOOHrQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to