Re:Tail Call Optimization: The Musical
by auggierose on Sunday January 08, 2023 @09:04AM
(#34299166)
Yes, algebraising your control flow to become independent of implementation details like that is a possibility. Of course, you need a language that makes that a) easy, b) performant.
Which recursion scheme guarantees tail-recursion?
Re:Tail Call Optimization: The Musical
by consilient on Monday January 09, 2023 @08:16AM
(#34309958)
`cata` with a cps'd argument
Haskell: https://hackage.haskell.org/package/recursion-schemes
Scala: https://github.com/precog/matryoshka