ezyang’s blog

the arc of software bends towards understanding

Tail recursion makes your loops cleaner

Recursion is one of those things that functional programming languages shine at—but it seems a bit disappointing that in many cases, you have to convert your beautiful recursive function back into iterative form. After all, iteration is what imperative languages do best, right? Actually, explicitly tail-recursive functions in functional programming languages can be fairly beautiful: […]

  • May 23, 2011