Course: COS326
Instructor: Andrew Appel
F 2019

Description of Course Goals and Curriculum

Functional programming is an overview of the topics involved in programming in the functional paradigm. More descriptively, this means that your code is pure, or that you can expect the same result every time you run your code (assuming you didn’t change anything, of course). This inevitably results in beautiful and bug-resistant design, and the functional paradigm is just as useful for industrial applications as for theoretical programs and proof-checking. The course covers both coding and proofs, and the topics tend to err on the side of the study of programming languages. The course is in OCaml.

Learning From Classroom Instruction

Lectures are Mondays and Wednesdays from 11am to 12:20pm, and precepts are fifty minutes on Thursday evening or Friday morning. Prof. Appel often starts lecture with an overview of the computer scientists who worked on the problem discussed later on in class, their environment and collaborators, and their motivations, as well as giving one or two descriptive examples of the modern-day applications of the problem. He then works from the ground up to build an intuition step by step. He’ll sometimes add a couple questions throughout the lecture. His teaching style is essentially a transparent view of his thought process in deriving each step of the way to illustrating how a problem works, and he’ll sometimes go from the naïve implementation to more complex and efficient models.

Learning For and From Assignments

The assignments are either all programming or half programming and half proofs. The first three assignments are a crash course on OCaml and the basic ideas of functional programming. The other four assignments have heavy proof elements, which underlies the point that this is a very theory-heavy class. Some of the later assignments also have a partner option. The coding parts of the assignment cover interesting and relevant problems in computer science, such as MapReduce and how it drives Google’s PageRank algorithm, parallel programming, and compilers. Coding in the functional paradigm is satisfying, but its nature requires you to have a good idea of how you’re going to build your project, as opposed to imperative languages where you can more or less hack stuff together. Each assignment is fairly in-depth, and some of them come off more as projects than problem sets. Prof. Appel is notorious for giving extremely difficult exams, but he makes them interesting and satisfyingly comprehensive, and he uses a fair curve.

External Resources

With a lot of applications track COS courses, you can go a long way with StackOverflow. For better or worse, this isn’t the case with OCaml, since it’s viewed as an academic language with much better practical alternatives. This isn’t a knock on OCaml, since it’s very descriptive, but most functional programmers use F# or Haskell (or even Javascript!). This means that you’re pretty much entirely reliant on lecture, precept, Piazza, and OCaml documentation. While you do have less options for external help, the preceptor is really helpful, and the assignments are closed enough that there wouldn’t be much to Google anyways. Office hours aren’t necessary but are very useful.

What Students Should Know About This Course For Purposes Of Course Selection

Functional programming is one of those fundamental CS courses that ideally everyone should take, but in practice a lot of people skip. You won’t see much OCaml in the real world, and the course is quite theoretical and geared toward people who would want to go to grad school. That being said, it expands your programming toolkit like none other, and Prof. Appel is a great lecturer with lots of fun and insightful stories.
Functional Programming

Add a Strategy or Tip