IndexAnnouncements
Instructor Contact Info
Course Description
Course Textbooks
Course Policies
Course Blog
Course Schedule
Homework Assignments
Handouts
Sample Code
Programming in SML
Announcements/Updates
The first class will be on Tuesday, Jan. 9, 2007 at 5:30pm in Ryerson 251.There will be no class on Tuesday, Jan. 16. Instead, a makeup class was scheduled for Friday, Feb 2 at the same time.
There will be a midterm exam during the first hour of class on Feb 6. A second in-class midterm exam will be held on Feb. 7. In lieu of a final, we will have a programming project, due at the end of Finals week (March 16).
Instructor Contact Info
Name Role Office Office hours Phone David MacQueen Professor Hinds 045 By appointment 2-4980 dbm@cs.uchicago.edu Course Description
Functional programming is a programming paradigm that views functions as first-class objects of computation and structures programs in terms of the definition and application of functions. It has also been called "value-oriented" programming because it deals primarily with immutable values and data structures, minimizing or even eliminating the use of assignment and other side-effects. The major advantage of functional programming is that it combines great expressive power with simplicity, making it possible to construct working programs more quickly, and making it easier to ensure that those programs work correctly.
The advantages of functional programming can be exploited in software engineering even in situations where the final software product is constructed using conventional imperative and object-oriented languages. One use of functional programming is to do rapid prototyping, exploring a design space quickly with less programming overhead. Another is the use of functional programs as executable specifications or models of the functionality desired in the final system. We will also look at examples where functional programming has been successfully used in real-world, commercial applications.
In this course we will use two popular functional languages, ML and Haskell, representing the hybrid and pure versions of the functional paradigm. No prior experience of functional programming is assumed, though some programming experience in languages like C, Java, or scheme is highly recommended.
Course Textbook
Their will be two textbooks for the course. The first, covering programming in Standard ML, is Elements of ML Programming, 2nd Edition (ML97) by Jeffrey D. Ullmann. The second textbook will cover programming in Haskell, and will be announced here soon.Programming Exercises
This course is centered on programming in Standard ML and Haskell, with regular programming exercises and examples. We will be using the SML/NJ compiler for Standard ML. There are several good sources of documentation and tutorials for SML/NJ available online, and some of these are given in the course SML/NJ page. Additional information and resources for programming in Haskell will appear here shortly.
Course Policies
- Grading will be based on the following weightings:
- Homework exercises: 45%
- Midterm exams: 2 at 15% each
- Final programming project: 25%
- Assigments: Homework assignments will normally be given at each class on Tuesday will be due at the beginning of class the following Tuesday. The default is to hand in hard copy, but if necessary homework can be submitted by email to dbm@cs.uchicago.edu. Neatness and clarity are important in submitted homework.
- Collaboration: We encourage students to discuss course material among themselves. Discussions of assignment problems is also permitted to some extent, but submitted assignments must be your own work, and collaborative discussions should be acknowledged in your homework write-up.
- Final Examination: The final examination will be a two hour in-class exam.
Course Blog
A course blog has been created for announcements and discussions. The homework assignments will be posted there and on this page.Homework Assignments
- Homework 1 (due January 23)
Solution 1- Homework 2 (due January 30)
Solution 2, fig3_3_6.pdf- Homework 3 (due February 6)
Solution 3
Code for Ex 5.2.3: fig4_10.sml (using Eof exception), fig4_10a.sml (using option type),
Syntax diagram for Exercise 5.7.2a: ex5_7_2a.pdf
Code for Exercise 5.7.2b: ex5_7_2b.sml- Homework 4 (due February 13)
Code for tic-tac-toe program: tic-tac-toe.sml- Homework 5 (due February 20)
Solution 5
Code for the streams problems: streams.sml- Homework 6 (due February 27)
Solutions for Problem 1: soln6.txt,
Code for Problems 2 and 3: soln6_2.sml.- Homework 7 (due March 6)
Midterm Solutions
Midterm 1 Solutions
Midterm 2 Solutions
Sample Code
- lambda-EV.sml: Call-by-value evaluator for the pure lambda calculus.
- bool.sml: the boolean expression example developed in class on Jan 30.
- set.sml: a module implementing a set abstraction.
- wff-mod.sml: another boolean expression program, organized in modules (here boolexp is called "wff", for well-formed-formula, another common term for boolean expressions).
- wff.tgz: The wff-mod.sml boolean expression program, split into separate files and provided with a CM description file wff.cm.
- quine.sml: a program to test whether a boolean expression, or wff, is a tautology.
- fun-parse.sml: a simple functional parser for a simple imperative language.
- mandc.tgz: a tarball containing a multifile program for missionaries and cannibals.
Additional Useful Links
More background on underlying programming language theory:
- Wikipedia on Functional Programming
- Why Functional Programming Matters
- A Guide to Functional Programming on the Web
- FAQ for newsgroup comp.lang.functional
- Tutorial Papers in Functional Programming (mostly pure/lazy)
- Functional Programming in the Real World
- Workshop on Commercial Users of Functional Programming, CUFP 2006
- PDF of slides of invited talk by Chet Murthy of IBM at POPL 07
Dave MacQueen Last modified: Fri Mar 9 00:32:58 CST 2007