[erlang-questions] Calling a Function with Same argument twice
Ulf Wiger
ulf.wiger@REDACTED
Thu Oct 15 13:17:25 CEST 2009
sapan shah wrote:
>
> So, the basic question is: If the test/2 function is side effect free
> (no put, no get or no io:format..), would erlang evaluater still call
> the test/2 function again, if it had called the same fuction with same
> arguments erlier???
The evaluator will always do so.
The compiler (which I assume was what you meant) is sometimes
able to inline the function, if it is a local function, and
simple enough. See the man page for the 'compile' module.
Otherwise, it will always call the function each time.
BR,
Ulf W
--
Ulf Wiger
CTO, Erlang Training & Consulting Ltd
http://www.erlang-consulting.com
More information about the erlang-questions
mailing list