CS 320 - Concepts of Programming Languages

Summer, 2019

Instructor and Lecture

Times and Locations


Instructor:Wayne Snyder

      Email: waysnyder at gmail dot com

      Office: MCS 290

      Office Hours: M - Th 4-6pm

     
      Cell Phone: 617-966-(210+41) (text in an emergency; in general, email vastly preferred, but if you call, leave a message!);

    


Lectures:

      M - Th 2-4pm (PSY B33)

Discussion/Labs:

     Th 4-5pm (PSY B33)

Teaching Fellows:

     Mark Lemay (lemay at bu dot edu)
         Office hours: TBA in Ugrad Lab

Useful Links

  • Signup Link for gitHub
  • Piazza
  • Syllabus
  • YouTube Channel: YT
  • Github: HTML
  • Programming Environments for Haskell:
  • Haskell.org (Haskell download and resources): HTML
  • Hoogle (Haskell search engine): HTML
  • Book: Learn you a Haskell for Great Good: HTML
  • Book: Real World Haskell: HTML
  • Hutton's PPT Slides based on book are on this site: HTML
  • PDF Slides by Ralf Lammel based on slides by Hutton: PDF
  • Haskell Cheat Sheet (nice summary of all of Haskell): PDF
Week
Dates
Lecture & Readings/Videos
Assignments and Practice Problems
1

T 5/21

W 5/22

Th 5/23

Administrative matters; Overall Plan for the course; Motivation: Why learn functional Programming?

Lecture Slides: PDF

Here is my channel where I will post lecture videos: YT

Bare-Bones Haskell: Constructing data expressions, functions on data expressions, expressions as trees, rewrite semantics;

Reading: Hutton Chapters 1 & 2; also you could look at section 8.2 on data declarations (just for the basic idea; ignore anything you don't understand).

Lecture Slides: PDF

Also, make sure you remember recursive tree traversals, particularly preorder and postorder; here is my CS 112 lecture on this: PDF

Here is a video talk-through of the last couple of slides from Lecture 2, which I did not finish in section A1: HTML

Function definition by pattern matching; polymorphic types.

Reading: Hutton, Ch. 3.1 - 3.7

Lecture Slides: PDF

Polymorphic data and functions; type checking; function definitions; modules

Reading: Hutton, Ch. 3.8 - end, 4.1 - 4.4

Lecture Notes: PDF

Analytical Homework Zero Solution: PDF

Practice Problems on data and function definitions and computation by matching and rewriting: HTML

Practice Problems 2 A Alternate (using build-in syntax for Integers, tuples, and lists) HTML

Practice Problems 2 B Alternate (using build-in syntax for Integers, tuples, and lists) HTML

Presented in lab on Thursday, due W 5/29: HWs from weeks 1 and 2

2

T 5/28

W 5/29

Th 5/30

F 5/31

Functions as first-class values; map and filter;lambda expressions; functions manipulating functions; modules.

Reading: Hutton, Finish chapter 4. On modules, read HTML up to right before the section on Data.List.

Lecture Notes: PDF

Basic Haskell: Haskell built-in list and tuple types; Case expressions; Beta-reduction for lambda expressions and let expressions; HO programming continued: Curried functions; (if time) Function composition with currying.

Reading: Hutton Ch. 4 & 7

Lecture Slides: PDF

Curried functions, HO programming paradigms concluded: foldr; Type classes.

Reading: Hutton 5 & 15.1-15.5

Lecture Slides: PDF

Type classes Continued.

Reading: Hutton, reread Ch. 3 and then read 8.1 - 8.5, and also section 12.1 (on Functors)

This section from "Learn you a ...." is also worth reading on the basic type classes: HTML

Also the beginning of this section, about the Functor type class, is very good: HTML

The first part of this, Functors with Pictures, is very good: HTML

Lecture Slides: PDF Type classes concluded.

Reading: Same as last time. Reread it!

Lecture Slides: PDF

 

Analytical Homework One Solution: PDF

Comments on HW 02 Coding (lang0 .. lang4): MP4

Here is a short video with some hints: HTML

Practice Problems 3: HTML

Quiz 1 Study Guide: HTML

3

M 6/3

T 6/4

W 6/5

Th 6/6

SOLUTION TO QUIZ ONE: PDF

Monads: the Maybe Monad

Lecture Slides: PDF

MonadLectureCode1: HS

MonadLectureCode2: HS

Video walk throughs of these two files have been uploaded to the YT channel linked at the top of this page, as well as a brief summary of my lecture.

Required Readings:

  1. Functors and Monads (ignore anything about Applicatives) in pictures:HTML
  2. Hutton, Ch. 12.3 (pp.164 - 166);
  3. Learn you a Haskell, A Fistful of Monads, ignore anything about "Applicatives" and you can skip the long example in the section "Walk the Line";

Optional readings (if you are interested):

  1. Dan Piponi's blog post "You could have invented monads": HTML
  2. Dan Piponi's blog post on the Trivial Monad: HTML
  3. Phillip Wadler's paper on monads: PDF
  4. Hutton's paper on monadic parsing in Haskell: PDF
  5. This is one of the better tutorials, very detailed, emphasizing the syntax: HTML
  6. A short blog post on the Monad Laws: HTML; here is a short but essential article on the monad laws, relating it to do expressions: HTML

Here are some videos on monads:

  • Hutton on monads: HTML
  • Our own instructor Abbas Attarwala on monads: HTML
  • Brian Beckman at Microsoft on monads: HTML

Even more optionally, here are some informative links about monads:

  • The Monad Tutorial Fallacy: HTML
  • The Monad Tutorials Timeline: HTML

Monads continued; the Ok Monad; the List Monad; List Comprehensions

Lecture Slides: PDF

MonadLectureCode3: HS

Video walk throughs of this file, and a two-part summary of my lecture have been uploaded to the YT channel.

Code discussed in class (videos posted to YT channel soon):

WriterMonad.hs: HS

ReaderMonad.hs: HS

The State Monad

Lecture Slides: PDF

4

M 6/10

T 6/11

W 6/12

Th 6/13

Implementing a functional language: Syntax, Context-Free Grammars, Parse Trees, Derivations; Parsing and Abstract Syntax Trees.

Lecture Slides: PDF

Reading on Context-Free Grammars: PDF

Another reading: HTML

Complete BNF for Haskell (see section 9.5): HTML

Parsing and Grammars

Example parser code from lecture: HS

Video short lecture on parsing: HTML

Lambda Calculus 1

Reading: Introduction to the Lambda Calculus: PDF

Lambda Calculus 2: Confluence and Evaluation order

Haskell: Lazy evaluation and infinite data structures

Lecture Notes: PDF

Reading: Hutton, 12.1 - 12.5

Infinite Lists; Lazy evaluation in Haskell concluded.

Reading: Finish chapter 15 in Hutton, then read this more precise exposition: HTML

Lecture Notes: PDF

Analytical Homework 3 Solution: PDF
5

M 6/17

T 6/18

W 6/19

Th 6/20

Conclusions on lazy evaluation in Haskell; foldl vs foldl'
Dynamic vs lexical scope for lambda expressions.

Read section 7.4 in Hutton on foldl.

Here is a rather complete introduction to lazy vs strict evaluation: HTML

Reading on scope (from stack overflow, with nice code examples): HTML

Lecture Notes: PDF

Implementing imperative features: assignments, loops, and mutable state.

Comments on the Project: general overview and static type checking

Lecture Slides: PDF

Comments on Project: Testing

Lecture Slides: PDF

YouTube Video on Basic Testing: YT

YouTube Video on Program Testing with Quickcheck. YT and files discussed there: DIR.

Study guide for Quiz 2:HTML

Analytical Homework 04 Solution: PDF

6

M 6/24

T 6/25

W 6/26

Th 6/27

Work on Final Project, due Friday 6/28 at midnight.