Functional Programming

 Faculteit Science and Engineering Jaar 2021/22 Vakcode WBCS002-05 Vaknaam Functional Programming Niveau(s) bachelor Voertaal Engels Periode semester I a ECTS 5 Rooster rooster.rug.nl

Uitgebreide vaknaam Functional Programming
Leerdoelen At the end of the course, the student is able to:
1) design algorithms in a functional style.
2) reason formally about functional programs and proof their correctness.
3) use polymorphism and higher-order functions.
4) reason about the time and space complexity of programs.
Omschrijving Functional programming is a declarative programming paradigm that treats computation (execution) as the evaluation of pure mathematical functions. A function is called pure if its output is always the same for the same input and its evaluation has no side effects. As a result, expressions in functional programs can be replaced with their corresponding values without changing the behavior of the program. Functional languages are based on the use of functions that, if required, can have functions as an argument and can produce functions as a result. The typing of a function or expression is thus very important. In functional programs, a variable within its scope has the same meaning everywhere (referential transparency). Moreover, data is immutable, which means that it cannot change after creation. A direct consequence of this property is that functional programming languages typically do not have looping constructs (for, while) since a looping variable needs to be mutable. Therefore, recursion is the only way to implement iteration.
In Haskell and some other functional languages, the value of an expression is only calculated when it is needed (lazy evaluation). This allows the construction of infinite data structures (e.g. a list of all prime numbers).
Referential transparency and the lack of side effects make functional programs relatively easy to analyse. An important theme of the course is how to apply mathematical reasoning to programs, so as to prove their correctness. These proofs almost always use mathematical induction.
The aim of the module is to teach students to design and analyse functional programs in Haskell, whereby an understanding of the efficiency and general typing aspects is very important.
The course has a theoretical part which is assessed using a written exam, and a practical part that consists of three practical assignments that need to be implemented in Haskell. The practical and the exam must be done in the same academic year.
Uren per week
Onderwijsvorm Hoorcollege (LC), Practisch werk (PRC), Werkcollege (T)
Toetsvorm Practisch werk (PR), Schriftelijk tentamen (WE)
(Let P=practicals, E=Exam. The final grade (F) is obtained as follows: F = (3*P+4*E)/7, under the constraint that E and P both are >= 5.)
Vaksoort bachelor
Coördinator dr. A. Meijster
Docent(en) dr. A. Meijster
Verplichte literatuur
Titel Auteur ISBN Prijs
Haskell: the craft of functional programming, 3rd Ed. Simon Thompson 978-9-201-88295-7
Entreevoorwaarden This course assumes no prior knowledge, but advises that the student has some programming experience in a regular programming language (like C, Java, Matlab). Moreover, secondary education equivalent to Dutch pre-university education (VWO second phase), is required, including sufficient Mathematical skills (wiskunde B).
Opmerkingen All CS bachelor courses have limited enrollment:
- CS students can always enter each course, regardless of whether the course is mandatory for them or not.
- A maximum of only 20 places per course is available for non-CS students. These places are filled on a first-come-first-served basis, with priority given to students with a strong CS-related background (e.g., CS exchange students, AI students, etc.). These students need to meet the course prerequisite requirements as mentioned on Ocasys.
- Six weeks before the course starts, the 20 students that can join are selected and added to the course. If you enroll after this date, you will be placed on the waiting list.