skip to primary navigationskip to content

Course pages 2022–23

Foundations of Computer Science

This course provides its teaching materials in a few formats for your convenience.


The course notes are published as a versioned PDF, with changes to subsequent versions noted here. You will receive v1.4 of these notes as a hardcopy.

Online Notebook

You can also access an interactive version of the same notes online at You will need to login via your Raven id, and then navigate to the focs-notebooks/ directory and click on the 1A Foundations of Computer Science.ipynb file.

The first thing you should do when you access it is to go to the Cell / Run All menu to execute all the code fragments. This interactive notebook spins up your own version of the notes, which you can edit and manipulate from your web browser. If you click on a code cell, edit it, and then press Shift+Enter, the server will evaluate your new code and show you the output.

You are encouraged to experiment with the OCaml code in this sandbox. If you need to reset your environment, simply click on Control Panel and restart your server, and you will be back to the original copy. Do not store precious notes in this notebook, as it may reset unexpectedly.

Offline Programming

Although not essential, you may find it convenient to install OCaml on your own computer. For that, you can follow the installation instructions at


Source Code examples

Past papers

The official past papers are available online. The unofficial translations below use OCaml rather than Standard ML (which was the language used for the course until 2020).

Recommended Reading

A good complement to this course is the OCaml From the Very Beginning book by John Whitington. If you are feeling advanced, then Real World OCaml may interest you -- but note that much of the content there is far beyond the syllabus required for Foundations of CS.

See also the OCaml Practical Classes for information about your ticks.