Lab 15

Lab 15 Instructions #

Reminders #

  • If you haven’t already, please 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.)

  • One laptop at a time per pair of partners.

  • Swap drivers at each exercise. Nobody likes a driving hog.

  • High five when you solve a problem. Why not? It just feels right.

Setup instructions #

Head to and follow the Lab Procedures.

Lab puzzle #

Consider the following two integer expressions that make use of the Lazy module (which you can assume has been opened already):

let n1 = let r = ref 0 in
         lazy (r := !r + 1;
               !r) in
force n1 - force n1 ;;

let n2 = lazy (let r = ref 0 in
               r := !r + 1;
               !r) in
force n2 - force n2 ;;

Which of these two expressions is greater?

A. The first expression is greater

B. The second expression is greater

C. The two expressions are the same