Discussion:
[erlang-patches] maps: pattern-match absent key?
unknown
2014-02-18 19:55:33 UTC
Permalink
Is there a way to pattern-match the absence of a key in a map?

Dan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20140218/5d6d9f0e/attachment.html>
unknown
2014-02-18 20:23:00 UTC
Permalink
Yes, with fail clauses.

f(#{ a := _ }) -> {a,present};
f(_) -> {a,absent}.
Post by unknown
Is there a way to pattern-match the absence of a key in a map?
Dan.
_______________________________________________
erlang-patches mailing list
erlang-patches
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>
Continue reading on narkive:
Loading...