[erlang-questions] pattern matching & map

Michał Muskała michal@REDACTED
Mon Nov 26 11:12:39 CET 2018


In OTP 21 you could use the map_get/2 guard:

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

Michał.
On 26 Nov 2018, 10:57 +0100, Oleg <lego12239@REDACTED>, wrote:
> Hi, all.
>
> I try to do the pattern matching in a function definition with maps:
>
> add_prms([{Name, Val}|T], #{Name := Vals} = Prms) ->
>
> But erlc says me:
>
> variable 'Name' is unbound
>
> Is this is not supported yet?
>
> Erlang/OTP 20
>
> --
> Олег Неманов (Oleg Nemanov)
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20181126/be293934/attachment.htm>


More information about the erlang-questions mailing list