How To Do A For Loop In Elixir (using only recursion)

Hm! Interesting paper. Very cool to see that so much can be built on top of foldr / foldl.

One thing the paper does not state, (and is often overlooked), is that foldl is tail-recursive, while foldr is not. There is a great example on the Haskell wiki about why this is the case.


EDIT: It seems that the distinction between tail-call and non-tail-call functions in Erlang/Elixir is not that important.

See:

1 Like