when is it best to use a recursive function vs a for loopjackpot@lemmy.mlbanned from sitebanned from site to Programming@programming.dev – 30 points – 10 months ago50Post a CommentPreviewYou are viewing a single commentView all commentsIn Elixir & Erlang, they don’t even have a for-loop construct. You have to use recursion. And I think that’s beautiful. I also think tail-call optimization is beautiful.Elixir does have for loops. https://hashrocket.com/blog/posts/elixir-for-loops-go-beyond-comprehension That being said, I have worked at a company who uses Elixir 4 years now and I have never once written one.Oh you’re so right, I never use those so I completely forgot :X
In Elixir & Erlang, they don’t even have a for-loop construct. You have to use recursion. And I think that’s beautiful. I also think tail-call optimization is beautiful.Elixir does have for loops. https://hashrocket.com/blog/posts/elixir-for-loops-go-beyond-comprehension That being said, I have worked at a company who uses Elixir 4 years now and I have never once written one.Oh you’re so right, I never use those so I completely forgot :X
Elixir does have for loops. https://hashrocket.com/blog/posts/elixir-for-loops-go-beyond-comprehension That being said, I have worked at a company who uses Elixir 4 years now and I have never once written one.Oh you’re so right, I never use those so I completely forgot :X
In Elixir & Erlang, they don’t even have a for-loop construct. You have to use recursion. And I think that’s beautiful. I also think tail-call optimization is beautiful.
Elixir does have for loops.
https://hashrocket.com/blog/posts/elixir-for-loops-go-beyond-comprehension
That being said, I have worked at a company who uses Elixir 4 years now and I have never once written one.
Oh you’re so right, I never use those so I completely forgot :X