I am trying to do something like this:
-module(count).
-export([main/0]).
sum(X, Sum) -> X + Sum.
main() ->
lists:foldl(sum, 0, [1,2,3,4,5]).
but see warning and code:
function sum/2 is unused
How to fix the code?
NB: this is just a sample that illustrates the problem, so there is no reason to suggest a solution that uses fun-expression.
source
share