Latest change Jan. 15, 2017
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.
Dec. 20, 2017: The first lecture will take place Monday Jan. 15, 10:15-12:00, in R2-121. This is also the roll call (upprop).
Dec. 20, 2017: The new home page for the course is under construction.
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.
This course is essentially the same as DVA201 Functional Programming with F#, which was given until 2015. What differs is basically that discrete mathematics have been added to the prerequisites.
Here is official information about the course. I may also set up a page in Blackboard for the course, where I then will 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.
Phone (MDH): N/A
Lab assistant: Joel Söderman
Phone (MDH): N/A
The course takes place in period 3 (lectures etc. with scheduled activities taking place weeks 3-8). The first event in the course is Lecture 1 (L1), with "upprop", which takes place Monday Jan. 15, 10:15-12:00, in R2-121.
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 (from VS2010).
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.
Be aware that it can be hard to finish the labs in time if you show up unprepared. The lab course (LAB1) is 2hp, which corresponds to 53 hours of work, whereas the scheduled time for the labs is 16 hours: thus, you are expected to spend most of the work with the labs outside the schedule! Therefore, we strongly recommend that you prepare well before you come to the lab session.
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 final grade (U-3-4-5) is based on the grade for the the written exam. Completed laborations and project before the first exam gives a one step raise of the grade at this exam: 3 -> 4, and 4 -> 5. This exam takes place March 22rd, 2018: complete and correct laborations and projects must thus be handed in before then, if you want the raise. The raise applies only to this exam, and not to any later exams.
Note that you can not get a raise from U to 3. This is different from previous years, where 5 bonus points were awarded right off at the first exam for completed labs and project.
Those of you who need to be examined in the earlier version of the course (DVA201): you will need to register for the new version of the course. If you have completed any part of the examination (TEN1, LAB1, PRO1) for the old course, then you can apply to have this accounted for in the new version of the course. As a rule I will grant such applications without further ado.
Oldtimers who have taken the earlier, Haskell-based 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 "some simple natural language processing".
Lab 4, A calculator with a GUI.
The scheduled laborations will take place in the usual computer rooms, with Windows-equipped PC's. F# 4.1 (the latest version), and VS 2017 (ditto) are set up on these machines.
If you run an older version of F# or VS then most of the lab exercises should still work right away. However, for Lab 4 it can make a difference: the lab instructions give support for different F# versions, and the FAQ provides some further support.The differences between the different F# versions are summarised by the Wikipedia page for F#.
You can download F# for free, to your own computer here (latest version, currently 4.1). 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 or later), then you already have F# (although it might not be the latest version).
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. Most linux distributions carry Mono, unfortunately often quite old versions. Newer versions can be downloaded here. If you use Ubuntu 14.04 or later (or some Ubuntu derivative) then Mono and F# are included in the distribution, and can simply be installed directly from the software center (or by using a suitable packet manager).
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. Submit the source code + report to one of the lab assistants. 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.
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. Thursday 2018-03-22, 14:10-18:30.
Next exam. Thursday 2017-06-07, 14:10-18:30.
Next next exam. Thursday 2017-08-16, 14:10-18:30.
See the web page for the Spring 2017 edition of the course.
Code that is brought forward for examination, for a laboration, for the project, or at the written exam, must be original. It is not allowed to copy the code from somewhere, like from the web, or from some friend. The project report must also be written by yourself. A violation of this rule will be considered as plagiarism, and dealt with as such.
It is OK to discuss with other students, in general terms, how to solve a certain kind of problem. But it is not allowed to disclose your solutions to other students such that they can base their solutions on yours. This will be seen as assistance to plagiarism. In particular it is not allowed to make your solutions publically available, at sites like github or sourceforge, such that other students taking the course can access them. The underlying principle is this: helping someone to understand is OK, helping someone to pass the examination without understanding is not OK.
In case you do a laboration or project in a pair, then it is OK that you divide the work between yourselves such that some of the code, or the report, is written by your teammate. You should then divide the work evenly: in particular it is not OK that one teammate does all the work, and the other teammate no work. You should also understand the parts of the laboration/project that you did not do yourself, and be able to answer questions also on those parts.
For the written exam, the usual rules apply. (See above for what you are allowed to bring to the exam.)
This is the course book:
Michael R. Hansen, Hans Rischel: Functional Programming Using F#, Cambridge University Press, 2013, ISBN: 9781107684065. Price USD 62.00 (Amazon, paperback), SEK 378 (Bokus, paperback), prices as of 2017-12-20. 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.
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.
The Wikipedia Entry on Functional Programming, and F#.
A text on asynchronous workflows.
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.
Clojure is a modern LISP dialect.
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.
A course evaluation will be opened towards the end of the course: we encourage you to answer it, since it can provide valuable feedback that can help us improve future instances of the course. The course analysis will to some extent be based on the evaluation.
The Spring 2017 edition of the course.