[erlang-questions] Updating a map

Donald Steven t6sn7gt@REDACTED
Wed Jan 30 15:37:16 CET 2019


Wow!  Thanks.

On 1/30/2019 8.13 AM, Guilherme Andrade wrote:
> 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 <t6sn7gt@REDACTED 
> <mailto:t6sn7gt@REDACTED>> 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
>     erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
>     http://erlang.org/mailman/listinfo/erlang-questions
>
>
>
> -- 
> Guilherme

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190130/157b9ba6/attachment.htm>


More information about the erlang-questions mailing list