Lab: Tail and helper recursion

Assigned
Monday, 27 October 2025
Summary
In this laboratory, you will explore recursive procedures in which we pass along intermediate computations, most typically using a recursive helper procedure. When this technique is used in conjunction with a program structure in which the recursive result is returned directly (without accumulated actions to perform), this technique supports tail recursion.

In this lab, we’ll further expand our understanding of recursion, considering how patterns (both pattern matching and patterns of recursion) and helper procedures improve our ability to recurse.

Preparation

  1. Introduce yourself to your partner, discuss strengths and weaknesses, work work procedures, and such.

  2. Grab the code.

Be sure to review the provided procedures.

Acknowledgements

This lab was rewritten in Spring 2023 based on previous tail recursion labs, the most recent of which was Fall 2021.