[erlang-patches] maps: pattern-match absent key?

Björn-Egil Dahlberg <>
Tue Feb 18 21:23:00 CET 2014


Yes, with fail clauses.

f(#{ a := _ }) -> {a,present};
f(_) -> {a,absent}.



2014-02-18 20:55 GMT+01:00 Daniel Goertzen <>:

> Is there a way to pattern-match the absence of a key in a map?
>
> Dan.
>
> _______________________________________________
> erlang-patches mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-patches
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20140218/a1fa8cec/attachment.html>


More information about the erlang-patches mailing list