Suppose you have a simple function, which can get quite expensive for large values:
fact(0) -> 1; fact(N) -> N * fact(N - 1).
Where can I
Depending on your case, you can also use the process dictionary for memoization:
fact(0) -> 1; fact(N) -> case erlang:get({'fact', N}) of F when is_integer(F) -> F; 'undefined' -> F = N * fact(N-1), erlang:put({'fact', N}, F), F end.