Course Content

Lecture Slides

CS135 has an extensive set of slides that are used in lectures. They are available for purchase from Media Doc. They are also available online (see below!) if you prefer to have them on your computer or print them yourself. In any case, you should have a copy that you can take notes on during lectures.

Reading the slides is not a substitute for attending lectures. The slides do not contain anything that the instructor says, writes on the board, or demonstrates on a computer during lectures. If you miss a lecture, you should contact a classmate who was present and catch up promptly.

M01 Syllabus Details about how the course works.
M02 Functions Writing functions is at the heart of using a functional programming language.
M03 The design recipe Our process for developing programs.
M04 Simple data We start with numbers, but also need strings, symbols, and booleans.
M05 Syntax & semantics of Beginning Student Defining rigourously what our programs mean.
M06 Lists Working with a list of data; data definitions.
M07 Natural numbers -- recursively Working with natural numbers based on a self-referential data definition.
M08 More lists Lists of lists, processing multiple lists, etc.
M09 Patterns of recursion Looking beyond simple patterns of recursion to accumulative recursion and generative recursion.
M10 Structures Data that belongs together.
M11 Trees Extending lists to include branches.
M12 Local definitions and lexical scope Software engineering.
M13 Functional abstraction Functions that consume or produce functions and more.
M14 Generative recursion Recursion that is not based on the form of the data.
M15 Graphs Directed graphs (not the Excel kind).
M16 Computing history Major milestones leading to functional and imperative programming.


Errors in the lecture slides will be listed here. If you discover an error that is not posted here, please talk to your instructor about it.

  • Slide M08-36: There is an error in the check-expects at the bottom of the slide. The argument to lookup should be an Association List instead of two lists. That is,

    (check-expect (lookup 3 (list (list 1 "John") (list 3 "Winnie"))) "Winnie")
    (check-expect (lookup 2 (list (list 1 "John") (list 3 "Winnie"))) false)
  • Slide M10-39: The data definition should be

    (define-struct salary-record (name amount))
    ;; A SalaryRecord is a (make-salary-record Str Num)
    ;; A Payroll is one of 
    ;; * empty
    ;; * (cons SalaryRecord Payroll)
  • Slide M11-47: The last line got truncated. It is (check-expect (list-names mammal) '("Mammal" "Primate" "human but should be (check-expect (list-names mammal) '("Mammal" "Primate" "human" "chimp" "rat").

  • Slide M11-53: line 3 is (cond [(number? ex) ... ex ... ] but should be (cond [(number? ex) (... ex ...) ].

  • Slide 11-63: line 3 is (cond [(number? ex) ... ] but should be (cond [(number? ex) (... ex ...) ].

  • Slide 11-72: line 2 is (cond [(number? ex) ... ] but should be (cond [(number? ex) (... ex ...) ].

  • Slide 12-27: the third last line of code runs off the slide. It should be [else (local [(define right (search-bt-path k (node-right tree)))].

  • Slide 12-42: The last line refers to module 10. It should be module 13.

  • Slide 13-32: The following two lines predate our use of (listof X) and are now wrong. Please ignore them.

    Since a type variable is used to indicate a relationship, it needs to be used at least twice in any given contract.

    A type variable used only once can probably be replaced with Any.

  • Slide M13-94: The summation should be over f(x_i) rather than x_i.
    Errata to the errata: It should be f(i).