• en

Teaching OCaml

OCaml is a high-level language that supports functional, imperative and object-oriented programming styles. As such, it is an excellent tool for teaching the fundamental concepts behind programming languages, type theory and systems.

For the full description of the benefits of the OCaml language please refer to the article on “Why OCaml?”.

This page is devoted to resources for people who are teaching OCaml in a University setting. It contains a list of courses in different Universities that use OCaml as a teaching language. It can help with setting up a course structure as well as finding the relevant contacts to discuss and share experiences. We also include relevant resources such as references to commonly used textbooks and tools for setting up your preferred environment to work with OCaml. We hope that this will make the task of shaping a programming course that uses OCaml a slightly easier task.

Don't worry if things do not work! OCaml has a vibrant and rapidly growing community behind it that is eager to help. If you find any problems with any of the tutorials or something is missing please let us know by getting in touch so we can help in making your experience with OCaml more pleasant. If you would like to add your course or other resources please feel free to create an issue.

Mailing list

We set-up a mailing list for professors who are teaching OCaml in schools and universities to discuss issues relating to using OCaml in an educational context.

Courses taught in OCaml

Here's a list of courses we know about that teach in OCaml. Please add yours if you don't see it listed!

North America

  1. Boston College - Computer Science I (CS 1101)
  2. Brown University - An Integrated introducion (CS 17/18) (along with Racket, Scala and Java)
  3. Caltech - Fundamentals of Computer Programming
  4. Columbia University - Programming Languages and Translators
  5. Cornell University - Data Structures and Functional Programming (CS 3110)
  6. Harvard University - Principles of Programming Language Compilation (CS153)
  7. Harvard University - Introduction to Computer Science II: Abstraction & Design (CS51)
  8. McGill University - Programming Languages and Paradigms (COMP 302)
  9. Princeton University - Functional Programming (COS 326)
  10. Rice University - Principles of Programming Languages (COMP 311)
  11. University of California, Los Angeles - Programming Languages (along with Python and Java) (CS 131)
  12. University of California, San Diego - Programming Languages: Principles and Paradigms (CSE130-a) (along with Python and Prolog)
  13. University of Illinois at Urbana-Champaign - Programming Languages and Compilers (CS 421)
  14. University of Maryland (along with Ruby, Prolog, Java) - Organization of Programming Languages (CMSC 330)
  15. University of Massachusetts Amherst - Programming Languages (CMPSCI 631)
  16. University of Massachusetts - Programming Languages (CS691F)
  17. University of Minnesota Twin Cities — Advanced Programming Principles (CSCI 2041)
  18. University of Pennsylvania - Compilers (CIS341)
  19. University of Pennsylvania - Programming Languages and Techniques I (CIS120)
  20. University of Virginia - Programming Languages (CS 4610)

Europe

  1. Aarhus University - The compilation course (along with Java)
  2. Aix-Marseille University - Functional Programming
  3. Epita - Introduction to Algorithms (Year 1 & 2)
  4. ISAE/Supaéro - Functional programming and introduction to type systems
  5. University Pierre & Marie Curie - Types and static analysis (5I555)
  6. University Pierre & Marie Curie - Models of programming and languages interoperability (LI332)
  7. University of Birmingham - Foundations of Computer Science (FOCS1112)
  8. University of Cambridge - Advanced Functional Programming (L28)
  9. University of Innsbruck - Programming in OCAML (SS 06)
  10. University of Rennes 1 - Compilation (COMP)
  11. University of Rennes 1 - Semantics (SEM)
  12. University of Rennes 1 - Programming 2 (PRG2)
  13. University of Wrocław - Functional Programming
  14. Université Paris-Diderot - Advanced Functional Programming (PFAV)
  15. Université Paris-Diderot - Functional Programming (PF5)

Asia

  1. Indian Institute of Technology, Delhi - Introduction to Computers and Programming (CSL 101) (along with Pascal and Java)

Map of courses around the world

Add your course to the map!

(Tip: Click on the relevant layer (e.g., US,EU), search for your University, click on the marker and click on "Add to map", fill in the info fields and you are done!)

Resources

Suggested Textbooks

This is a list of books and lecture notes that are being used for teaching OCaml. There is also a wider list of books to choose from, which you can find on the books page.

  1. The OCaml System: Documentation and User's Manual This the official User's Manual. It serves as a complete reference guide to OCaml. Updated for each version of OCaml, it contains the description of the language, of its extensions, and the documentation of the tools and libraries included in the official distribution.

  2. Lecture notes for Penn's CIS120. Like the course, this book covers both OCaml and Java, and is intended for students with no programming background.

  3. Real World OCaml, also available online. Used by Harvard's CS51 course.

  4. Jason Hickey's Introduction to Objective Caml, originally developed as lecture notes for Jason's course at Caltech

Teaching tools

This section lists some of the available tools that are or can be used in a classroom or lab.

In the browser

The OCaml bytecode is relatively straightforward to convert to Javascript. This allows any OCaml code to run in a Web browser, which is very convenient when delivering individual tutorials to a class as there's minimal set up time involved.

For a quick example of OCaml in the browser, try any of the following:

  1. IOCaml Notebooks
  2. A compiler from OCaml bytecode to Javascript
  3. Try OCaml
  4. Compile OCaml Online
  5. Codepad
  6. Run OCaml Code Online

OCaml installation

Check out our Install OCaml section

Alternative guides

  1. Installation Instructions from Real World OCaml

VM images

This is a list of VM images that some Universities use to avoid setup delays and provide a consistent environment.

  1. OCaml 4.01 for MAC
  2. Cornell's Linux VM VirtualBox image (more info here)
  3. Princeton's Ubuntu VirtualBox VM (more info on the course's site)
  4. Mirage Virtualbox VMs via Vagrant

Tutorials and Exercises

University tutorials and notes

  1. From UMass's CS691F Programming languages course
  2. CSE 130: Programming Languages Course at UCSA. Click on Lectures and Discussion Notes. Have a look at Lec 7 (a pp presentation by Zach) for an inspiring introduction into map and fold.
  3. CS 3110 Fall 2013 :: Data Structures and Functional Programming at Cornell. The lecturing materials explain OCaml on the basis of the fundamental concepts of functional programming languages.
  4. CIS 500: Software Foundations at UPenn. A Software Fundations course with strong emphasis on Types. The OCaml Tutorial includes a gentle introduction to the OCaml interactive top-level system and compilation in OCaml.