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.

  • (Virtual) 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 about the course? Let me know: shieber@seas.harvard.edu.

Setup instructions #

Head to http://url.cs51.io/lab2 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 = 
  List.map ((/) 2) ;;