Latest change Aug. 20, 2014
To prevent spambots from collecting mail addresses, all mail addresses on this page have the "@" replaced by "#".
If you don't like the frame with the links, then open this link in a new tab or window.
Aug 20, 2014: Here are the suggested solutions to the exam taking place Aug 20.
June 9, 2014: Here are the suggested solutions to the exam taking place June 9.
May 22, 2014: There seems to be a similar mistake regarding the written exam in August: there are exams scheduled both Aug. 20 and Aug. 21. Again the second one is wrong, so do not register for that one. The right one is Aug. 20, 8:10-12:30.
May 21, 2014: Somehow, two different examination dates have been given to the upcoming written exam: June 9, and June 12. The second one is wrong, do not register for this one! The right one is June 9, 8:10-12:30!
Feb 11, 2014: I have made a course evaluation, which is partly based on the results from the course inquiry.
The almost latest news.
Functional Programming with F# is a basic level (G1F) 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.
Here is official information about the course. The course also has a page in Blackboard, where I have put a link that points to this web page that you're visiting right now. (The web page here is the main source of information about the course.)
Phone (MDH): 021-151709
Office: room U1-091, IDT (Rosenhill, 1st 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 assistant: Björn Dagerman
Phone (MDH): N/A
Lab assistant: Henrik Alnestig
Phone (MDH): N/A
The course takes place in period 2 (lectures etc. taking place weeks 46-51). There is a schedule for lectures and laborations: it also indicates when I will bring up different topics, and contains links to my slides and pointers to the relevant sections of the course book. See also the official schedule.
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: notably, it is a first class language in Visual Studio 2010 and later versions.
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.
The course can also be followed as a distance course, although it is not formally offered as such. Everything that should be needed is provided through this web page: plan for lectures with lecture material, directions for reading the course literature, laborations, suggested projects, link for downloading the F# compiler, etc. The teachers will be available for questions via e-mail. We will not provide lectures directly over the web, though, and the written exam must be taken at the Mälardalen University campus unless it can be arranged with a local university or similar.
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 2). This exam takes place Jan 15th, 2013: complete and correct laborations and projects must thus be handed in before then, 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.
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-024 and U2-029, with Windows-equipped PC's. We have set up F# 2.0 on these machines. (There are different options: two command-line versions, and a version integrated into Visual Studio).The difference between F# 2.0 and the latest version, F# 3.0, seems minor and will almost certainly not affect the part of F# that we use in the course. Therefore we have decided to stay with the old version, since we know that it is stable on our machines. The differences between the versions are listed here.
You can download F# for free, to your own computer here (version 3.0). This page contains instructions how to install F# on a number of platforms including Windows, Mac, and linux. Note that if you have Visual Studio 2012 Ultimate or Professional, then you already have F#.
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 3.0 or later for F# 3.0 (Mono v. 2.0 for F# 2.0). Most linux distributions carry Mono, however often quite old versions. Newer versions can be downloaded here.
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 2-3 pages) containing the following:
If you do a project suggested by yourself, then the report should also 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 one of the lab assistants.
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 be dealt with in an appropriate manner.
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.
First exam. Wednesday 2014-01-15, 14:10-18:30: exam, and suggested solutions
Next exam. Monday 2014-06-09, 8:10-12:30: exam, and suggested solutions
Next next exam. Wednesday 2014-08-20, 8:10-12:30 exam, and suggested solutions
Monday 2013-01-07, 8:10-12:30: exam, and suggested solutions
Thursday 2013-06-13, 8:10-12:30: exam, and suggested solutions
Thursday 2013-08-15, 8:10-12:30: exam, and suggested solutions
This is the course book:
Michael R. Hansen, Hans Rischel: Functional Programming Using F#, Cambridge University Press, 2013, ISBN: 9781107684065. Price USD 47.79 (Amazon, paperback), SEK 336 (Bokus, paperback). The book has a home page.
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 F# Language Specification (v. 3.0).
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 here.
Functional programming for parallelism: MapReduce, and Erlang.
A Brief Survey of Functional Programming Languages: an attempt to give you some context.
The slides for the course are found from the detailed schedule.
A set of exercises.
FAQ (Frequently Asked Questions) for the course.
Microsoft F# Developer Center.
hubFS: THE place for F#.
The Wikipedia Entry on Functional Programming, and F#.
Erlang is a functional and process-parallel language, originally developed at Ericsson, which is extensively used in real applications.
Scala is a "better java" which integrates element of object-oriented and functional programming languages.
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.
There is a course evaluation for the HT2013 instance of the course. This evaluation is partly based on the results from the course inquiry, where the students have stated their opinions about the course.