Latest change March 28, 2003

To avoid spam, all mail addresses on this page have the "@" replaced by "#".

CD 5100 Functional Programming, Fall 2002 (Period 1)

Table of Contents

Latest News

I have added som suggestions for Haskell-related thesis projects (exjobb).

General Information

Functional Programming is a B level course in Computer Science (datalogi) that is given by Dept. of Computer Science and Engineering (IDt) at Mälardalen University. It yields 5 credits.

Official information about the course, including the course plan. (In Swedish.)

All material in the course (including this web page) will be in English, but lectures will be in Swedish unless non-Swedish-speaking students will be taking the course.

Teachers

Course leader: Björn Lisper
Email: bjorn.lisper#mdh.se
Phone (MdH): 021-151709
Office: room 375, IDt (Vargens Vret, 2nd floor)

I'm best reached via email. During the hours when the department is open (13.00 - 15.30) you can feel free to drop in if I'm in office (I'll simply throw you out if I'm busy), but often I'm out on different missions.

Course assistant: Lars Bruce
Email: lars.bruce#mdh.se
Phone (MdH): 021-101465
Office: room 323, IDt (Vargens Vret, 2nd floor)

Lab assistant: Johan Malmström
Email: jom#mail.jcd.se

Mailing List

There is a mailing list cd5100#idt.mdh.se, that is used for rapid distribution of important course information to the students. (You can also use it yourself if you want to reach the course participants in some important matter.) All students who register for the course will become members of the mailing list. If, for some reason, you don't want to be included, (or, if we somehow miss to put you on the list), then please mail Lars about it.

Schedule

The course takes place in period 1 (weeks 35-41). There is a schedule for lectures and laborations, which also indicates when I will bring up different topics. See also the official schedule.

Course Contents

The purpose of this course is to give the students a solid understanding of functional programming, its applications, and its strengths and weaknesses. This includes knowledge of recursion, advanced data structures, modern type systems, higher order functions, lazy vs. eager evaluation, the importance of freedom of side effects, how to regain stateful (imperative-like) programming while retaining freeedom of side effects, and more. Probably we will also give short orientations of lambda calculus and implementation techniques for functional languages, in order to enhance the understanding of the functional programming paradigm.

In order to reach these goals, the course will be based on the functional programming language Haskell. This language represents state-of-the-art in functional languages, and learning it thoroughly will give you good knowledge of all the things mentioned above. It will also show how powerful the functional programming paradigm can be from a software engineering point of view - this paradigm provides, arguably, the best support for writing concise, reusable, and safe programs.

How to Follow this Course

It is recommended that you read the part in the literature that will be covered before the lecture, see the detailed schedule. If you come unprepared to a lecture you risk wasting your time by not understanding it. Also, reading the literature beforehand might give rise to questions that can be brought up and answered during the lecture.

Don't be afraid to be active during the lectures. The dumbest questions are the ones never posed.

Don't be a sausage waiting to be stuffed!

Examination

There will be laborations (LAB1, 1p), a written exam( TEN1, 1p) and some kind of programming assignment or project (PRO1, 3p). To get a pass on the course, one needs to pass all these examination moments. I have not yet decided whether to base your grades (3-4-5) only on the written exam, or let the laborations or project influence it. Completed laborations and project before the first exam gives five bonus points at the first written exam (2002-10-29).

Despite the official points awarded for the different examination moments, I will attempt to design the exam and project such that the workload for the exam corresponds to 3p and the project to 1p. This is more in accordance with the redesign of the course. It was simply an oversight not to change the points in the examination for this version of the course.

Furthermore, your grade will be decided from the written exam rather than the project. But to make this work we have to report the grade from the written exam when we report the project. Those of you who complete the project before the written exam will temporarily get the grade 3, and then the grade is adjusted when you have passed the written exam.

Oldtimers from previous years: since the contents of the course has changed a bit, it will require some effort from you to be examined on the new version of the course. Therefore, Boel Almér (boel.almer#mdh.se) has agreed to examine you according to the old version of the course.

Laborations

There will be four laborations, see the schedule. You will typically do the laborations in groups of two. Signup forms for the laborations will be posted outside the laboration halls. The laborations are in Haskell, and the two last laborations use the Haskell Graphics Library for interactive animations in Haskell.

Lab 1, getting started.

Lab 2, a little bit more advanced.

Lab 3, where you are supposed to do a little animation.

Lab 4, where you are supposed to extend your animation into a simple interactive game.

The scheduled laborations will take place in V423. This hall is equipped with PC's. We have set up the Haskell interpreter Hugs on these machines, under Windows, but you are free to use any other environment and Haskell implementation if you want. (However, the Haskell Graphics Library has to be supported.) With Hugs and a text editor like emacs (or any other of your choice), you can develop programs by editing the Haskell code in the text editor and loading and testing them in Hugs. See our Getting Started guide.

The software needed is available also for Linux (see further below).

Here are some Emacs Tutorials, in case you want to use emacs and are unfamiliar with it.

You can download implementations of Haskell for your own computer here. We do recommend Hugs, which is an interpreter for Haskell. It is easy to install and use, and it provides support for the Haskell Graphics Library (which is found at the Hugs site).

Project

There will also be a programming project, where you are given a problem to solve using functional programming techniques. The project will take place towards the end of the course, and we will try to design it so the the workload corresponds to one manweek per person. The idea is that you work with the project quite independently, but we will provide advising. V423 have been scheduled at two occasions for this, see the detailed schedule. You are of course also free to ask us questions outside these occasions, in person (when we have time) or by email.

There are some suggested projects to choose from. However, you can also suggest your own projects. In this case you should write your own specification of the project and give to us. We will then judge it, possibly suggest modifications, and finally decide whether we think it is appropriate or not.

One group has implemented a raytracer in Haskell. Here are some pictures.

The project is done in groups of at most two persons. Two is the preferred size of the project groups, but you can also do a project on your own.

The projects will be examined by email. You should submit the following to Lars: the source code, and a short written report (typically 1-2 pages) that briefly describes how you have solved the problem and gives an account for any interesting findings. If you do a project suggested by yourself, then the report should include the project specification. The solution will be judged primarily for correctness, but also for efficiency, clarity, etc. This means, for instance, that a very clumsy solution that works still might require some improvement to pass. The report will also be judged: thus, we might require that a poor report is rewritten before we give a pass on the project.

Examination by email is convenient for both you and us, but there is of course a risk of cheating (mainly that inactive project members benefit from the companion's work). I account on your high moral that this won't happen. (In the end, cheaters only cheat themselves anyway.)

Written Exam

The written exam is five hours long. Course literature is not allowed at the exam. This also includes all other information that could replace parts or all of the course literature, such as own notes, copies of slides, other books, and such. Computers with Haskell implementations (or any other stored information that could aid the student) are also not allowed. However, "general" aids, that are not specific to Haskell or functional programming, are allowed, such as calculators without any stored information of relevance to the course.

See also our general information about written exams (in Swedish).

Upcoming Exams

Third try: Sometimes in late August, I guess (but has to be verified)

Old Exams

All these documents will be in PDF format.

This Year

Tuesday 02-10-29: exam, suggested solutions, and my comments to the exam.

Tuesday 03-01-07: exam and suggested solutions.

Last Year

These are not relevant since the course was redone this year, and thus quite different from previous years. If you are interested, though, they are found here.

Literature

Paul Hudak: The Haskell School of Expression: Learning Functional Programming through Multimedia, Cambridge University Press, New York, 2000, 416 pages, paperback ISBN: 0521644089, Hardback ISBN: 0521643384

The book is available at Studentbokhandeln. Student price is SEK 323.

A list of known errors in the book.

Directions for reading: what parts of the literature are of relevance for the written exam.

If you want to know all the details of Haskell, here's the online Haskell report.

Recommended (Optional) Literature

Another good textbook is Simon Thompson: Haskell: The Craft of Functional Programming, Second Edition, Addison-Wesley, 507 pages, paperback, 1999. ISBN 0-201-34275-8.

Also see the Haskell Bookshelf.

Extra Course Material

A Brief Survey of Functional Programming Languages: an attempt to give you some context.

All slides for the course in 4-up.

A set of exercises.

Links

Learning Haskell.

Some Haskell links with more reading.

Frequently Asked Questions for comp.lang.functional.

The Wikipedia Entry on Functional Programming.

Workshop on Functional and Declarative Programming in Education (FDPE02).

The Evolution of a Haskell Programmer, or how to write the factorial function...

The infamous Lambda Dance.

Thesis Projects (exjobb)

I can offer some Haskell-related thesis projects (exjobb). We cannot pay for them, but on the other side we have freedom to tailor them to become maximally interesting! Feel free to come by my office and discuss if you are interested. I have defined two projects for the moment, see below, but it is certainly possible to define other projects if some interesting ideas pop up.

Course Evaluation

The course evaluation is closed. These are the results. My course analysis is to some extent based on the evaluation.


Viewable With Any Browser

Björn Lisper
bjorn.lisper#mdh.se