Lab: Recursion basics

Assigned
Wednesday, 28 October 2026
Writeup due
Friday, 30 October 2026
Summary
In this laboratory, you will practice writing recursive procedures.

In this lab, we’ll gain some intuition about the mechanics of recursion by practicing reading, rewriting, and writing recursive code.

Important procedures

  • (car lst) - grab the first element of a list
  • (cdr lst) - remove the first element of a list
  • (cons val lst) - add a value to the front of a list
  • (null? lst) - determine if a list is empty?
  • (null? (cdr lst)) - determine if a list has one element

Preparation

a. Introduce yourself to your partner, discuss strengths and weaknesses, decide upon work procedures, etc.

b. Load the lab.

c. Review the procedures included in the lab to make sure that you know what they are intended to do.

d. Follow the instructions!