News for hackers. Stuff that matters.
Re:Functional Imperative Programming with Elixir (2018) by sixstring982 on Thursday November 21, 2019 @01:13AM (#21591840)
Or just use recursion?

But hey, this article is an interesting way to get around that!

Re:Functional Imperative Programming with Elixir (2018) by bitwalker on Thursday November 21, 2019 @10:53AM (#21595364)
Well, I pointed out at the beginning that one can use recursion, and the implementation of the `while` construct itself uses recursion as well (in fact, you can't implement `while` without it in Elixir).

In any case, expressing the equivalent of a `while` loop with predicates and timeouts is quite syntactically noisy in Elixir - it is certainly doable, but much less clear than the imperative equivalent.