COMP 212: Functional Programming

Dan Licata Spring, 2021


The purpose of this course is to introduce the theory and practice of functional programming (FP). The characteristic feature of FP is the emphasis on computing by calculation. The traditional distinction between program and data characteristic of imperative programming (IP) is replaced by an emphasis on classifying expressions by types that specify their behavior. Types include familiar (fixed and arbitrary precision) numeric types, tuples and records (structs), classified values (objects), inductive types such as trees, functions with specified inputs and outputs, and commands such as input and output. Execution of imperative programs is generalized to evaluation of well-typed expressions by a smooth extension of mathematical experience to programming practice.

The advantages of FP are significant:

By the end of the course, we expect you to:
  1. write functional programs
  2. analyze their sequential and parallel complexity
  3. reason mathematically about their behavior
  4. structure them using abstract types

Prerequisites: COMP 211. MA 228 (or some other math class if you're not ready for that yet) works well as a corequisite.


There will be two lectures per week. Lectures will be asynchronous and videos will be linked from the lectures page. Lectures will be your primary source of information for the course, but there are also readings (lecture notes from a previous instance of this course) that present most of the material.

There will be weekly lab sessions held on Thursdays at 1pm and 2:50pm and Fridays at 1pm. Labs will be conducted synchronously on Zoom. The intention of labs is for you to practice the skills introduced in lecture, under the supervision of the TAs, to prepare you for the week’s homework. The lab assignment will be handed out on Wednesday; you are expected to familiarize yourself with the assignment and with related lecture material before lab. Because different students work at different rates, we do not expect everyone to finish all of the problems in the lab handout. We do expect you to put in a good-faith effort to work on the provided problems and learn something. Labs will be graded on a scale of 0/1: you will receive a 0 if you do not attend lab at all, you leave early, or you do not engage with the material. You will receive a 1 if you put in a good-faith effort and the TAs and I determine that you have made satisfactory progress. If you cannot attend a lab for some reason, you can do it on your own or at a TA session and see a TA to get checked off.

There will be weekly written and programming assignments. Homeworks are designed to help you internalize the course material; they consist of written problems and short to medium-sized programming tasks. No credit will be given for homework handins that do not compile. Homeworks will be submitted by uploading them to a Google Drive folder. No late homeworks will be accepted, except by permission of instructor.

For assistance with the homeworks, there will be regular help sessions with me and the TAs. Attendance at these is optional. The Wednesday 1pm scheduled course meeting time will be used for either homework help sessions or group review sessions, depending on attendee interest.

In place of exams, there will be non-collaborative challenge problems on most homeworks. These problems will test your proficiency with the previous week's material without help from the course staff. Generally, the challenge problems will be worth around 10% of an assignment, so e.g. the difference between a B and an A.

Generally, the flow of the class will be lecture-lab-lecture-homework, so I recommend watching the first lecture of the week after completing the previous homework, and the second lecture after doing the lab.


Your grade will be based on lab participation (5%) and homework assignments (95%). Generally, 90%-100% should be interpreted as A work, 80-90% as B, 70-80% as C, 60-70% as D, and below that as failing. However, the instructor may adjust the final letter grade boundaries in either direction at the end of the semester, to account for differences between the intended and actual difficulty of the assignments. Assignments will be graded for correctness, clarity, and efficiency. You are allowed to take the course CR/U, but note that a C- or better is required for a grade of CR, and D+ or less will be interpreted as U. Please also note that this course is a requirement for several other minors/certificates such as data science, and those may require a letter grade, so if you are interested in those you should check the requirements carefully before deciding.