3 ms·
> Recursion is the way to go in Erlang / Elixir I think it's important to realise that they're different ways of writing the same thing. For example, in Lisp,
by kbp 8y ago
> Recursion is the way to go in Erlang / Elixir
I think it's important to realise that they're different ways of writing the same thing. For example, in Lisp, the 'do' operator is basically a C-style for loop: in Scheme, it's a macro over tail recursion, and in Common Lisp, it's a macro over gotos, but it provides an almost identical interface to programmers. Using recursion over loops is just a stylistic/syntactic choice, the really important part is understanding how recursive functions are equivalent to loops, and vice versa, so that you can apply your experience in one situation to the other.
- rad_gruchalski 8y agoHence I said “in Erlang / Elixir”. Because, really, in those two, recursion IS the only way to go.