Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

COMP 311 / COMP 544: Functional Programming (Fall 20222023)



Instructor

Robert "Corky" Cartwright



Lectures

DCH 1064

Lecture Times

9:

25am–10

25 am–10:

40am

40 am TuTh

Instructor Emailcork@rice.eduOnline DiscussionPiazza – Rice Comp 311


Brief Description


This class provides an introduction to functional programming. Functional programming is a style of programming in which computations are solely expressed in terms of applications of functions to arguments (which themselves can be functions). This style of programming has a long history in computer science, beginning with the formulation of the Lambda Calculus as a foundation for mathematics. It has become increasingly popular in recent years because it offers important advantages in designing, maintaining, and reasoning about programs in modern contexts such as web services, parallel (multicoremulti-core) programming, and distributed computing. Course work Coursework consists of a series of programming assignments in the Racket , and Java , and Haskell programming languages plus occasional programming languages followed by a discussion of frameworks for reasoning about functional and imperative programs supported by written homework assignments on underlying theory.

Grading, Honor Code Policy, Processes, and Procedures

...

Students with disabilities are encouraged to contact me during the first two weeks of class regarding special needs. Students with disabilities should also contact Disabled Student Services in the Ley Student Center and the Rice Disability Support Services.


General Information


Office Hours


Instructor




Corky Cartwright

TuTh


3pm-4pm

By appointment

DCH 3104

TBA

Teaching Assistants

Clayton Ramsey

Andrew Obler

Barret Glass

Hunena Badat

TBA

TBA

TBA

Jones Commons

TBA

Zoom

TBA

TBA


Textbooks and articles

There is no required textbook. We will follow the pedagogic approach of "How to Design Programs, First Edition" and extend it to other languages. The Second Edition of this book is the default at the website www.htdp.org but this web page contains a link to the first edition (at URL:

 

https://htdp.org/2003-09-26/) at the bottom of the page.  The two editions are very similar but this course tracks the first edition

We will draw material from a variety of sources, including:

Advanced material
  • Slides skimming the advanced material covered in Comp 411)
Recommended Videos
Development Environment
  • DrRacket is recommended for all Racket homework assignments in this course. The interface is "textually transparent" as we will show in class.
  • DrJava is the supported IDE for Java in this course
, but you are
  • ; it supports essentially the same textually transparent interface for Java that DrRacket does for Racket.  You are also welcome to use
any
  • a "professional" IDE such as
IntellJ
  • IntelliJ or Eclipse
.We are still evaluating IDEs for Rust
  • , which have important features (particularly with regard to program refactoring) that DrJava lacks.
  • For students who want to explore Scala, a putative successor to Java that directly supports functional programming, there are multiple online IDEs and interpreters available.


Lecture Schedule (In Progress)


1

Tu

Aug

23

22

Motivation and the Elements (Constants) of Racket

Skim HTDP First Edition, Part 1 (Ch 1-8), Part 2 (Ch 9-10)
Sep 01


ThAug
25
24Conditionals, Function Definitions, and Computation by Reduction
Sep 03


2

Tu
Sep 01

Aug 29

Conditionals, Function Definitions, and Computation by Reduction

Homework 1

Review Ch 8

HTDP Part 2 (Ch 9-10)

Sep
08
04
3Th
Sep 03
Aug 31

The Program Design Recipe for Racket

focusing

, which focuses on using

recursion

to process lists and natural numbers

Preface, 9.4

HTDP Part 2 (Ch 11-13)

Sep 10

4

Tu

Sep

06

05

Data Definitions, Data-driven Structural Recursion,

Homework 2

HTDP Part 3

Sep
15
11
5ThSep
08
07Mutually Recursive Definitions and Help FunctionsHTDP Ch 15-17
Sep 15

6

Tu

Sep

13

12

Local Definitions and Lexical Scope

Homework 3

HTDP Parts 5-6

Sep
22
18

7

Th

Sep

15

14

Lambda the Ultimate and Reduction Semantics

LawsOfEvaluation
Sep 22

8

TuSep
20
19


Functional Abstraction and Polymorphism
Sep 29


9

Th

Sep

22

21

Functions as Values

Homework 4Sep
29
28

10

Tu

Sep

27

26

Generative (Non-structural) Recursion


Homework 5 (long)*Oct 11

11

Th

Sep

29

28

Lazy Evaluation and Non-strict Constructors

Homework 5*Oct 11


12

Tu

Oct

04

03

Techniques for Implementing Lazy Evaluation



13

Th

Oct

06

05

A Glimpse at Imperative Racket and Memoization

Sample Exam


Tu

Oct

11

10

Fall Recess

Sample Exam Key

13

14

Th

Oct

13

12

On to Java!

Midterm (Through Lecture 13 and HW 5) 7-10 pm

Homework 6

OO Design Notes

 

Oct 23

14

Tu

Oct

18

17

Adapting the HTDP Design Recipe to Java

Midterm (Through Lecture 13 and HW 5) 7-10pm

Homework 6 Oct 25




15

Th

Oct

20

19

Higher-order Functional Programming in Java

Homework 7Oct
31
26

16

Tu

Oct

25

24

Four Key Idioms for Encoding FP in Java

Homework 7Nov 1



17

Th

Oct

27

26

The Singleton and Visitor Patterns

Homework 8Nov 1

18

Tu
Nov 01

Oct 31

Java Generics and Their Role in FP in Java

Homework 8*

Nov 10


19

Th

Nov

03

02

Functional Rust I

Reasoning About Functional Programs

Homework 9*Nov 8

20

Tu

Nov

08

07

First-order Programming Logic (an analog of ACL2 [UT Austin])

Functional Rust II

Nov 15



21

Th

Nov

10

OO Rust Using Only Traits

09

Theorem Proving Strategies

Homework 10
Nov 15
Homework 9

22

Tu

Nov

15Rust ...

14

Hoare Logic



23

Th

Nov

17Rust ...Homework 10Nov 29

16

imperative Loop Invariants vs. Contracts for Help Functions


Homework 11Nov 27
24TuNov
22Rust ...Homework 11*Dec 2
21Reasoning About Procedure Calls

25TuNov
29Rust Concurrency
28Hoare Logic Applied to OO Code

26Th
Dec 1
Nov 30The Future of FP and Programming Logic

*Assignments marked with * are double assignments that count twice as much as regular assignments.  **indicates the project in lieu of a final examination.

...