Previously I blogged about tail call optimization and mysterious defn+ macro that could fool Python (or rather the programmer) to think that it can be done in Python without messing with frames and such. This time I’m going to show the macro implementation and point out some specific parts of it.
Recursive functions are functions that call themselves in order to perform computation. In order to avoid infinite loops, there usually is a case study inside that has at least one terminating branch and at least one branch that causes the function to recurse and move towards the termination. Two most common examples I have seen are calculating fibonacci numbers and factorials.