I have started some hands on in Erlang and I am getting : ** 1: syntax error before: \'->\' ** whenever i am declaring any function for eg. to calculate sum of a
** 1: syntax error before: \'->\' **
Or use the lists:foldl/2 function. This is copied directly from the Erlang Reference Manual.
1> lists:foldl(fun(X, Sum) -> X + Sum end, 0, [1,2,3,4,5]). 15