CSC324H5 Lecture Notes - Lecture 3: Tail Call
Document Summary
Recursion (void) means no return value (begin allows to produce multiple items at a time) When we do a recursive call we have have that function added to the frame. If you use tail recursion we can prevent stack over flow as the memory will just remember the last value. We take this property of racket to go from non-tail to tail recursion for both performance and safety reasons. If we recall the example from last class extract-numbers. We use accumulators to return the numbers in the list. Our base case is to return accumulator else we do the recurivse call (tail recursion) Our helper function takes 2 arguments, the list and accumulator. To make it more clear the [] brackets are just for organization purposes. We know when a function creates a new frame during recursion call when the output has mutliple stacked >> As a result we know that a new frame has been created.