Lab 3

Lab 3 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.)

  • New partners starting today! Introduce yourselves. Shake hands. Trade contact info. High five for practice. You’ll be together for the next two labs.

  • Get out paper and pencil. You’ll need it for this lab.

  • One laptop at a time per pair of partners.

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

  • Have you looked over the solutions to lab 2 yet? If not, you’re missing out.

Setup instructions #

Head to and follow the Lab Procedures.

Lab puzzle #

Today’s lab puzzle concerns the following OCaml function definition:

let rec which condition lst =
  match lst with
  | [] -> [], []
  | hd :: tl ->
      let where, who = which condition tl in
      if condition hd then true :: where, hd :: who
      else false :: where, who ;;

Get out some paper and a pencil to get ready. You’ll need it.