Lab 2

Lab 2 Instructions #

Reminders #

  • While other students are coming into class, feel free to go ahead and download the lab materials in preparation for the start of the lab proper. Setup instructions are below. (But please wait until you’re instructed before beginning work on the lab.)

  • Swap drivers at each exercise. Steering wheel egalitarianism.

  • High five when you solve a problem.

  • Remember, the goal is understanding, not getting the exercise to “work”.

  • Have you looked over the solutions to lab 1 yet? They’re excellent if I do say so myself.

  • Do you have hints or tips about the course? Let us know:

Setup instructions #

Head to and follow the Lab Procedures.

Puzzle #

Today’s puzzle concerns the following two functions:

let rec function1 (lst : int list) : int list = 
  match lst with 
  | hd :: tl -> (hd / 2) :: function1 tl
  | [] -> [] ;;

let rec function2 : int list -> int list = ((/) 2) ;;