[erlang-questions] Matching Empty maps
Björn-Egil Dahlberg XB
bjorn-egil.xb.dahlberg@REDACTED
Tue Feb 7 16:25:23 CET 2017
On 02/07/2017 12:45 PM, Joe Armstrong wrote:
> So #{} is an empty map in an argument position but not an empty map
> in a pattern.
Yes, of course!
There is a difference between patterns and values. They are not the same
thing.
A pattern does not need to describe the entire thing in match. It just
has to describe the things it needs to match.
Records are the precursor to the map behavior of course. For example,
-record(r, {a,b,c}).
foo(#r{}=R) ->
R.
// Björn-Egil
More information about the erlang-questions
mailing list