2 ms·
Recursion? We don't need no stinking recursion
- moomin 8y agoMultirec is an example of a refold. They are surprisingly common in real problems you encounter. The Haskell equivalent is hylo. https://www.stackage.org/haddock/lts-11.10/recursion-schemes-5.0.2/Data-Functor-Foldable.html#v:hylo https://www.stackage.org/haddock/lts-11.10/recursion-schemes...
- TheBestKorea 8y agoSomething which is perhaps overlooked in JS is that there is a recursion depth built into many engines. Using pure iteration circumvents this making the engine hang instead of error if your algorithm would loop infinitely.