4 ms·
I wish there was more explanation with the = sign in Erlang. In that it's not an assignment but a pattern match first. IIRC, it pattern match first and if the
by digitalzombie 12y ago
I wish there was more explanation with the = sign in Erlang. In that it's not an assignment but a pattern match first.
IIRC, it pattern match first and if the variable is not assign then it'll assign it IIRC. The code and explanation just state that it's Erlang to do assertion.
I think that's an interesting concept at least when I play with Erlang.
- krzysz00 12y agoI guess one interpretation of Erlang's = (this is from someone rather new to the language) is "Make the thing on the left equal to the thing on the right without mutating existing variables. If that's impossible, error". That nicely accounts for the apparent dual nature of the = operator.
- wwweston 12y agoI don't know Erlang, but I have done some Prolog and this sounds an awful lot like unification of an equality predicate.