This is a post about writing elegant and performant recursive algorithms in Rust. It makes heavy use of a pattern from Haskell called recursion schemes, but you don’t need to know anything about that; it’s just an implementation detail. Instead, as motivation, I have benchmarks showing a 14-34% improvement over the typical boxed pointer representation of recursive data structures in Rust. Performa
![Elegant and performant recursion in Rust](https://cdn-ak-scissors.b.st-hatena.com/image/square/d0b2b7ae3339ed5911a145e15a3e8fc4ba07e92d/height=288;version=1;width=512/https%3A%2F%2Frecursion.wtf%2Fimg%2Favatar-icon.png)