[erlang-questions] is this a well written function

Fred Hebert mononcqc@REDACTED
Mon Feb 9 16:18:11 CET 2015


On 02/09, Roelof Wobben wrote:
> A new try after some remarks :
> 
> % When End is equal to zero all the numbers are added
> sum_acc(Acc, 0) ->
>      Acc;

The only criticism I'd have is that usually, Erlang programmers will put
the accumulator last in the list of arguments, and the variable you
iterate on in first positions.

So the function clause above would be

    sum_acc(0, Acc) ->
        Acc;

Regards,
Fred.



More information about the erlang-questions mailing list