Latest change Aug. 26, 2010

To prevent spambots from collecting mail addresses, all mail addresses on this page have the "@" replaced by "#".

DVA201 Functional Programming with F#, Fall 2009 (Period 2)

Latest News

Aug 26, 2010: The exam 2010-08-26, and suggested solutions are available online.

June 11, 2010: The exam 2010-06-10, and suggested solutions are available online.

April 28, 2010: the re-examination ("omtentor") will take place: Thursday June 10, 8:10-12:30, and Thursday Aug. 26, 8:10-12:30. Don't forget to sign up in time if you want to participate!.

Jan 28, 2010: I have made the result list for the exam Jan 7, 2010 available in Blackboard.

Jan 27, 2010: I have made a course analysis, based on the results for the course and your answers to the course evaluation.

Jan 15, 2010: Stefan Björnander is on leave and will not return as course assistant. Therefore, if you have labs or project left you can send them to me (Björn) instead (email is fine). Beware that now, when the course is over, I have to give priority to other things so it might take some time before your lab/project will be graded.

The almost latest news.

General Information

Functional Programming with F# is a "Grundnivå 200" course in Computer Science (datavetenskap) that is given by the School of Innovation, Design, and Engineering (IDT) at Mälardalen University. It yields 7.5 hp.

Official information about the course (in Swedish), including the course plan (ditto). Here is the Blackboard entry for the course.

Teachers

Course leader: Björn Lisper
Email: bjorn.lisper#mdh.se
Phone (MdH): 021-151709
Office: room U3-120, IDE (Rosenhill, 3nd floor).

I'm best reached via email. When the department is open 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 and Lab assistant: Stefan Björnander
Email:Stefan.Bjornander#mdh.se
Phone (MdH): 021-101689
Office: room U3-129 (Rosenhill, 3nd floor).

Schedule

The course takes place in period 2 (lectures etc. taking place weeks 45-50). 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. We will also give short orientations of lambda calculus and type inference, 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 F# (see also Wikipedia). This is a modern functional language, 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. F# originates from Microsoft Research, and it is a member of the .NET family of programming languages. Thus, it is likely that it will become widespread in the future.

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. Thus, you will be able to get more out of the lecture.

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

Examination

There will be laborations (LAB1, 2hp), a written exam (TEN1, 4hp) and a small programming project (PRO1, 1.5hp). To get a pass on the course, one needs to pass all these examination moments. The grade (3-4-5) is based on the grade for the the written exam. Completed laborations and project before the first exam gives five bonus points at the first written exam (at the end of period 1). Deadline for handing in laborations and projects is Jan 6th, if you want the bonus points.

Oldtimers who have taken the earlier functional programming course (CDT201, or CD5100): if you want to be examined, please get in touch with me to see if we can find a solution for you.

Laborations

There will be four laborations, see the schedule. You will typically do the laborations in groups of two. The laborations are in F#.

Lab 1, getting started.

Lab 2, lists, higher order functions, and defining own data types.

Lab 3, topic "simple bank accounting".

Lab 4, topic "some simple natural language processing".

The scheduled laborations will take place in U2-023 and U2-029, with Windows-equipped PC's. We have set up F# on these machines. (There are different options: two command-line versions, and a version integrated into Visual Studio).

Downloading F#

You can download F# for free, to your own computer here. There is an MSI self-installing archive, which installs all that is needed on a Windows machine, and a zip archive. Non-Windows users must use the .zip archive, which also contains instructions how to install the software.

Non-Windows users also need Mono, which is an open implementation of the .NET CLR that allows .NET applications to be run also on non-Windows platforms. You will need Mono version 2.0 or later. Most linux distributions carry Mono, however often quite old versions. Newer versions can be downloaded here.

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 the workload should correspond to roughly one manweek per person. The idea is that you work with the project quite independently, but we will provide advising.

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.

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: 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.

Submit the source code + report to the course assistant.

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. Discovered cases of cheating will of course be dealt with in the usual manner.

Written Exam

The written exam is four 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 F# implementations (or any other stored information that could aid the student) are also not allowed. However, "general" aids, that are not specific to F# or functional programming, are allowed, such as calculators without any stored information of relevance to the course.

Please note that signup for the exam in advance is mandatory! Signup is to be done through the MDH Student Portal.

This Year's Exams

Thursday 10-01-07, 8:10-12:30: exam, and suggested solutions.

Thursday 10-06-10, 8:10-12:30: exam, and suggested solutions.

Thursday 10-08-26, 8:10-12:30: exam, and suggested solutions.

Old Exams

This is a new course, so old exams are not available. However, there is an example exam, and suggested solutions.

Literature

This is the course book:

Don Syme, Adam Granicz, Antonio Cisternino: Expert F#, Apress, 2007, ISBN10: 1-59059-850-4. Price USD 63.99 (Amazon), SEK 649 (Bokus). Home page for the book with extra material.

This book is not perfect as the main book for this course, but it is the best one that I have found and I needed to decide before it became too late. Akademibokhandeln in Västerås will not bring it in, since it will become too expensive to buy through them, so you will have to buy it at some webshop like Amazon or Bokus.

A list of F# books (and other resources) is found here.

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

If you want to know all the details of F#, here's the online F# Draft Language Specification.

Recommended (Optional) Literature

If you have an interest in functional programming, you may want to check out the language Haskell for which there are also a number of good and pedagogical textbooks. See the Haskell Bookshelf.

Extra Course Material

Functional programming for parallelism: MapReduce, and Erlang.

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

All slides for the course in 4-up. The slides are also found, one by one, from the detailed schedule.

A set of exercises.

FAQ (Frequently Asked Questions) for the course.

Links

Microsoft F# Developer Center.

hubFS: THE place for F#.

The Wikipedia Entry on Functional Programming, and F#.

Google uses a functional programming model to specify much of their data processing.

Erlang is a functional and process-parallel language, originally developed at Ericsson, which is extensively used in real applications.

Typetool, on online type inference service. You give it a simple functional program (lambda-expression), and it will infer the most general type for it and show you how it was derived (or tell why it failed).

Thesis Projects (exjobb)

I may offer some functional programming-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.

Course Evaluation

There is a course evaluation form, please take your time to fill it in and submit to me! You can leave the form (anonymously if desired) in my mailbox at IDT, or send it by snail mail to:

Björn Lisper
Akademin för innovation, design och teknik
Mälardalens högskola
Box 883
721 23 Västerås

I have made a course analysis, based on the results for the course and your answers to the course evaluation. However, you are still welcome to send in a course evaluation form with your view if you like. Feedback in other forms is also welcome.

Earlier Versions of the Course

This will be the first edition of the course DVA201. However, it was preceeded by the course CDT201 Functional Programming, which had a similar content but was based on the programming language Haskell rather than F#. This course was given the last time in 2007.


Viewable With Any Browser

Björn Lisper
bjorn.lisper#mdh.se