CSE 341: Programming Languages
Course information and policies
This course is an introduction to functional programming (FP). We will cover statically typed FP in OCaml and dynamically typed FP in Racket. We will also relate FP to object oriented (OO) languages, and show how to simulate FP in OO and OO in FP. Along the way we will discuss the theory and design of programming languages.
This is a difficult time. The course will be taught entirely online via Zoom. We will record lectures and section for archival purposes, but real-time attendance is mandatory except in extenuating circumstances. Please get in touch to discuss any accommodations you may need to succeed in this course.
James Wilcox (he/him, they/them)
Jiuru Li (he/him)
Katie Lum (she/her)
Frank Qin (he/him)
Yihong Zhang (he/him, they/them)
Kevin Zhu (he/him)
Approximately 6 homework assignments, combined worth 60% of final grade
Two "individual assignments", together worth 30% of final grade
Attendance and participation in lecture, section, office hours, and online discussion, worth the remaining 10%
No traditional exams, tests, or quizzes
You are encouraged to discuss the homework assignments with your classmates and to collaborate. However, the work you submit should be your own. Do not look directly at anyone else's work or solution. Do not show your work or solution to anyone else. If you work closely with another student, please include a note to that effect in your submission.
Real-time attendance at lecture and section is mandatory except in extenuating circumstances (eg, in a different timezone). If you must miss any of these, please notify all staff by email as soon as possible.
All assignments are due on some day at 5:59:59pm Pacific time. You have 5 late days to use throughout the quarter. Late days are indivisible, and each late day extends the deadline by 24 hours. In other words, if you submit at 6:00:00pm Pacific time on the due date (i.e., 1 second after the deadline), you are charged 1 whole late day and have until 5:59:59pm the next day to keep submitting without spending additional late days. Late days may not be used on "individual assignments".
Staff email list: firstname.lastname@example.org
Gradescope (add code: 9DWB6R)
Setting up OCaml environment:
Instructions to install the CSE VM (available to all students)
Once in the VM install OCaml by running sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh) && opam init && eval $(opam env) in the terminal. Type 'y' when it asks to modify ~/.bash_profile.
SSH into attu (remote CSE Linux cluster, available to CSE students only): from terminal, ssh <CSENetID>@attu.cs.washington.edu , password is your CSE login password. attu has OCaml installed on it.
To use OCaml in the terminal (VM or attu): type ocaml to start the REPL, ocaml <OCaml file name> to execute an OCaml file, or ocamlc -o <output file name> <OCaml file name> to compile an OCaml file into an executable with the given output file name.
UW CSE505: Programming Languages (graduate-level course)
UW CSE490P: Advanced Programming Languages and Verification (advanced undergrad-level course, includes videos)
Software Foundations (graduate-level online textbook on programming languages, using the Coq proof assistant)
Types and Programming Languages by Benjamin Pierce (standard graduate-level textbook in programming languages)
hw0 (due Monday 10/5 at 5:59:59pm Pacific time)
hw1 (due Wednesday 10/14 at 5:59:59pm Pacific time)
If you're using attu, you will get errors about the Option module because of an old version of OCaml installed on the server. Follow these instructions (also available in video walkthrough) to install an up-to-date version of OCaml in your attu home directory.
Alternatively, you can download option.ml, put it under the same directory with your hw1.ml, and then run
or, to compile, use ocamlc -o hw1 option.ml hw1.ml,
or type #mod_use "option.ml";; before your #use "hw1.ml" if you are using the REPL.
hw2 (due Friday, 10/23 at 5:59:59pm Pacific time)
hw3 (due Monday, 11/2 at 5:59:59pm Pacific time)
hw4 (due Thursday, 11/12 at 5:59:59pm Pacific time)
hw5 (due Friday, 11/20 at 5:59:59pm Pacific time)
hw6 (due Wednesday, 12/2 at 5:59:59pm Pacific time)
hw7 (due Friday, 12/11 at 5:59:59pm Pacific time)
All videos (CSE netid or course enrollment required)
L01 (9/30): Welcome to 341! Intro to variable bindings in OCaml.
S1 (10/1): Editors, OCaml scoping
L02 (10/2): Syntax and semantics of variable bindings and expressions; intro to function bindings
L03 (10/5): Function bindings
L04 (10/7): Tuples and Lists
S2 (10/8): Type synonyms, datatypes, pattern matching, type generality
L05 (10/9): Local bindings, exponential efficiency, options, mutation and aliasing
L06 (10/12): Records, variants, and match expressions
L07 (10/14): More variants and match
S3 (10/15): More pattern matching, tail recursion
L08 (10/16): The truth about functions; Nested patterns
L09 (10/19): Tail recursion and exceptions
L10 (10/21): First-class and higher-order functions
S4 (10/22): Higher-order functions
L11 (10/23): Lexical Scope; Closures; Intro to Currying
L12 (10/26): Closure idioms; More Currying
L13 (10/28): Mutation; Modules
S5 (10/29): Currying, Modules
L14 (10/30): Type inference
L15 (11/2): Guest Lecture on Rust by Max Willsey
L16 (11/4): Racket
S6 (11/5): Racket Basics, Lists
L17 (11/6): Local bindings, pairs, set!, and mutable pairs
L18 (11/9): Thunks, promises, and streams
No class on 11/11
S7 (11/12): Streams, Macros
L19 (11/13): Macros
L20 (11/16): Untyped Lambda Calculus
L21 (11/18): Structs in Racket
S8 (11/19): Macros and Language Interpretation
L22 (11/20): Implementing Languages (including closures)
L24 (11/30): Course motivation and Static vs. Dynamic Typing
L25 (12/2): Racket OO
S9 (12/3): Racket OOP, Pattern Matching, For Loops
L26 (12/4): Subclassing, Overriding, and Augmenting
L27 (12/7): Dynamic dispatch
L28 (12/9): Functional vs Object-oriented decomposition, the Expression Problem, and Double Dispatch
S10 (12/10): Double Dispatch, Subtyping
L29 (12/11): Subtyping; Victory Lap