News for hackers. Stuff that matters.
Re:Should function arguments be reassignable or mutable? by testvox on Monday January 01, 2018 @12:34PM (#16046984)
You don't usually write for loops in Erlang, as a functional language loops are better expressed as recursive functions.

Here is an example of using a recursive function in Erlang to sum up a factorial.

  fac(1) ->
      1;
  fac(N) ->
      N * fac(N - 1).
Re:Should function arguments be reassignable or mutable? by maxxxxx on Monday January 01, 2018 @01:08PM (#16047149)
Does Erlang handle the stack better? In most languages this would blow up if N got big enough.
Re:Should function arguments be reassignable or mutable? by bearhall on Monday January 01, 2018 @01:38PM (#16047305)
Yes. Erlang has tail recursion which helps prevent that http://learnyousomeerlang.com/recursion
Re:Should function arguments be reassignable or mutable? by dragonwriter on Monday January 01, 2018 @01:43PM (#16047339)
As the article notes, what Erlang has is Last Call Optimization, this is significantly more general than tail recursion optimization.