[erlang-questions] clarify: How are functions assigned to variables compared in Erlang?
Juan Jose Comellas
juanjo@REDACTED
Thu Dec 13 07:28:23 CET 2007
Suppose I assign some functions to variables and compare them like this:
1> F1 = fun(X) -> X + 1 end.
#Fun<erl_eval.6.49591080>
2> F2 = fun(X) -> X + 1 end.
#Fun<erl_eval.6.49591080>
3> F3 = fun(X) -> X + 2 end.
#Fun<erl_eval.6.49591080>
4> F1 =:= F2.
true
5> F1 =:= F3.
false
What is the Erlang VM doing when it executes these comparisons? Does is
compare the bytecode of each function or does it compare them using some
kind of unique identifier? What I'm trying to determine is the cost of
comparing two functions assigned to variables.
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20071213/d5e663a9/attachment.htm>
More information about the erlang-questions
mailing list