[erlang-questions] pattern matching & map

Oleg lego12239@REDACTED
Mon Nov 26 12:12:24 CET 2018


On Mon, Nov 26, 2018 at 11:12:39AM +0100, Michał Muskała wrote:
> In OTP 21 you could use the map_get/2 guard:
> 
> add_prms([{Name, Val}|T], Prms) when map_get(Name, Prms) =:= Val ->

Wow. That's great! But why we can't simply do:

add_prms([{Name, Val}|T], #{Name := Vals} = Prms) ->

:-)?

-- 
Олег Неманов (Oleg Nemanov)



More information about the erlang-questions mailing list