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.
Here is an example of using a recursive function in Erlang to sum up a factorial.