Each handout is a single .rkt file you open in DrRacket and Run. Running it executes
the code, including the tests.
From recitation 3 on, most handouts are written in #lang plai-typed. These are plain
Racket files with comments, so you read them in the editor.
A few untyped handouts (recitations 1, 2, 3b, 7, and the macro handout in 5) are
Scribble literate programs
(#lang scribble/lp2). For these, the Scribble HTML/PDF button also renders the
handout as a page with clickable links to the Racket docs.
Recitation 4 also has a Lean 4 file, rec04/bexp.lean. See Setup for how to open it.
| # | Topic | Handout | Solutions |
|---|---|---|---|
| 1 | Functional programming in Racket, DrRacket, recursion, lists & higher-order functions | recitation1.rkt | recitation1-solutions.rkt |
| 2 | Boolean expressions: structs, writing an interpreter, and optimizations | recitation2.rkt | recitation2-solutions.rkt |
| 3a | Typed boolean expressions in plai-typed: define-type, type-case, exhaustiveness |
recitation3a.rkt | recitation3a-solutions.rkt |
| 3b | Pattern matching: literals, wildcards, and destructuring lists | recitation3b.rkt | recitation3b-solutions.rkt |
| 4 | Adding pattern matching to the interpreter; boolean expressions and proofs in Lean | recitation4.rkt, bexp.lean | recitation4-solutions.rkt |
| 5 | Environments as functions; static vs. dynamic scope | recitation5.rkt, macro.rkt, unhygienic.c | recitation5-solutions.rkt |
| 6 | Mutable state: boxes, the store, set!; tables as a language feature |
recitation6.rkt, arb.c, ltr.rkt, rtl.ml | recitation6-solutions.rkt |
| 7 | Recursion: tying the knot with boxes; the Y and Z combinators; rec via Z |
recitation7.rkt, recitation7-interp.rkt | recitation7-solutions.rkt, recitation7-interp-solutions.rkt |
- Handouts are posted before recitation with exercises left as
'TODO. We fill them in together during the session, so bring a laptop with DrRacket if you want to code along. - Solutions are posted after recitation as a separate file.
Layout convention:
recNN/
recitationN.rkt # handout (exercises as 'TODO)
recitationN-solutions.rkt # posted after recitation
Some weeks are split into parts (recitationNa.rkt, recitationNb.rkt, each with its own
solutions file).
- Install Racket (DrRacket ships with it).
- Open the handout in DrRacket, e.g. rec01/recitation1.rkt.
- Press Run. You should see
"Hello, world!"in the interactions pane — then you're set. - From recitation 3 on, you'll also need
plai-typed. In DrRacket, go to File → Install Package… and enterplai-typed, or runraco pkg install plai-typed. To check it worked, open rec03/recitation3a.rkt and press Run. If you see test failures that sayTODO, you're set. If you seecollection not found, the package isn't installed. - For the Lean file in recitation 4, you don't need to install anything. Open
live.lean-lang.org in your browser and paste in the contents
of rec04/bexp.lean. The panel on the right shows the output of
#evaland the proof state as you move your cursor through the file.