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

  • 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.

  • Do you have thoughts about the course? Let us know:

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 ;;