[erlang-questions] one-time evaluated functions

Kostis Sagonas kostis@REDACTED
Mon Oct 30 22:15:55 CET 2017


On 10/30/2017 04:41 PM, Jarosław Preś wrote:
> Hi,
> 
> Is it possible to make an erlang function be evaluated only once at 
> first call and then return this value each time?

Many answers have already been given for this question.  I only want to 
point out that the above only works for functions that are pure, in the 
sense that they are not only side-effect free (e.g. do not print, send 
messages, etc.), but also do not have dependencies on the state in any way.

Kostis



More information about the erlang-questions mailing list