Lab 14

Lab 14 Instructions #

Reminders #

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

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

  • High five when you solve a problem. Or at least the Zoom approximation.

  • Do you have hints about the course? Let me know: shieber@seas.harvard.edu.

Setup instructions #

Head to http://url.cs51.io/lab14 and follow the Lab Procedures.

Lab puzzle #

Today’s lab puzzle has to do with the following two integer expressions that delay and force evaluation as described in today’s reading:

let n1 = let r = ref 0 in
         fun () -> (r := !r + 1;
                    !r) in
n1 () - n1 () ;;
let n2 = fun () -> (let r = ref 0 in
                    r := !r + 1;
                    !r) in
n2 () - n2 () ;;