[erlang-questions] Updating a map

Guilherme Andrade <>
Wed Jan 30 14:13:09 CET 2019


Hello Donald,

Ever since Erlang/OTP 18 (or 19? I don't recall which), you can use the
shorter map update syntax like this:

Map = #{foo => bar, hello => world},
UpdatedMap = Map#{foo := barbar, hello := moon}.

More information here:
http://erlang.org/doc/reference_manual/expressions.html#map-expressions


On Wed, 30 Jan 2019 at 12:27, Donald Steven <> wrote:

> The documentation for maps:update states:  update(Key, Value, Map1) ->
> Map2, but since update has an arity of 3, this doesn't work:
> update(Key1, Value1, Key2, Value2, Map1) -> Map2.  Is there an
> other-than one-by-one-sequential-update to update more than one
> key-value in one shot?
>
> Thanks.
>
>
> Don
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>


-- 
Guilherme
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190130/0c06bcde/attachment.html>


More information about the erlang-questions mailing list