Comp 372: Programming Languages

Spring 2004 - Peter L Dordal

Comp 372-003, 1:40-2:30 MWF Damen 441; also Comp 471-857

Texts:
Simon Thompson, Haskell: The Craft of Functional Programming, Addison-Wesley, 1999.
Paul Graham, On Lisp, Prentice Hall, 1993. Download it for free!

My general course groundrules are here. Exams will count for between 70% to 80% of your grade, with homework and programs making up the rest. The midterm is tentatively scheduled for Week 8, Monday, February 23. The final will be April 19, 1:45-3:45 pm, in our usual classroom.


Study materials: Assignments, notes, handouts, sample exams and review guides will be linked here as available.

Here is a preliminary version of the final exam study guide. The guide probably won't change a lot, though. Note that the final exam will be open-book under the same terms as the midterm exam. Study guide answers are here.

Here is the midterm study guide. Answers are now here.

Here is the first Lisp assignment.
Here is the second programming assignment, in Haskell.

Here is the third programming assignment, in Lisp, involving eval-to-death and the Rose database. The file roses.lisp is here.

Here is the game assignment (4th program), in Lisp (specifically, using CLOS, the Common Lisp Object System). The file adventure.lisp is here, all in a single piece (I will develop a set of broken-up pieces soon).

Here is the makeup/extra assignment. It is required for those registered for COMP 471. It is optional for those registered for COMP 372; however, it does count for extra credit in COMP 372, in the form of points added to your midterm score up to a maximum of 76. See the instructions for details as to how many extra points you can earn. The assignment is to modify the game in java; here is the java source code game.java.

Here are my (sometimes sketchy) class notes.

Here is a programming language overview.
Here is the LISP handout.
Here is the first demo Haskell program (up to fib2).


Reachability: Certain announcements and individual messages may be sent to you via email. You are expected to receive them; make sure I have your preferred email address.

Goals: The goal of the course is to compare and contrast the familiar imperative programming idiom with the alternative approaches of functional programming and object-oriented programming. We will begin, after a brief overview, with the Lisp language. Lisp goes back to 1959, and is still an actively used language in the Artificial Intelligence community. Lisp has a strikingly unusual syntax, but its ability to treat data as programs is even more striking. Other innovative features of Lisp include run-time type checking, list processing (from which the name derives), and dynamic memory management with garbage collection. Finally, Common Lisp includes the Common Lisp Object System, or CLOS.

After Lisp we will look at Haskell, which illustrates polymorphism and type inference, and lazy evaluation.

After Haskell we will return to the more familiar world of object-oriented programming: C++, Java, and CLOS.

Computers: We will be using the free "trial" version 6.2 of Allegro Common Lisp for Lisp programming.

For Haskell, we will use hugs.

Prerequisites: Students are expected to be reasonably familiar with either the Java or C++ language, and have a reference book available. I'll survey you at some point about which of Java versus C++ you're more familiar with.

The following schedule is a little obsolete; we'll see how things go.
Week 1: Review of C++ A functional style within C++: recursion, expressions, parameters, references, pointers.
Week 2: Lisp: atoms and lists, basic operations, setf, defun.
Week 3: Lisp: cond, recursion (cdr and car/cdr forms), let, iteration with do
Week 4: Memory management, other data structures, multiple-value returns, exceptions.
Week 5: Haskell basics: patterns, etc
Week 6: Haskell list recursion
Week 7: More Haskell
Week 8: Midterm; Expression evaluation
Week 9-10: TBD
Week 11: Theory of expression evaluation; parameter passing issues (parameters: value, reference, result, value-result, name, order of eval, etc)
Week 12: CLOS v C++ v data-driven programming
Week 13: Java or C++
Week 14: Java or C++

Projects: There will be about five programming projects. None are intended to be particularly ardurous, although programming in a new language is often harder than programming with something familiar.
 
Grades: Programming assignments will count for about 25-30% of your grade; the remaining 70% will be based on your midterm and final exams. The final will count 25-40% more than the midterm. It will be partially cumulative, but will focus more on material covered since the midterm. Before both exams you will receive a review guide, with some sample questions and answers.

Academic Honesty: Your work on exams is expected to be entirely your own; failure to adhere to this may result in an F for the course. As for written homework assignments, talking to others about confusing points is permitted and, to some extent, encouraged. However, it is expected that all actual solution writing, program typing, and program design be done by yourself. In particular, the sharing of your program source files is never acceptable. Inappropriate collaboration may result in your receiving a zero for the homework or programming portions of the course.