After successful completion of the course the student is able to:
- Solve programming problems in a functional language.
- Explain and apply standard techniques such as recursion, list comprehension, higher order functions, and function composition.
- Explain the importance of typing.
- Define, use, and manipulate compound types, algebraic types and recursive types (tree structures).
- Describe differences between functional programming languages and object-oriented programming languages.
- Explain the role of lazy evaluation.
During your studies most of the courses on programming are according to the imperative, object-oriented approach. In this paradigm a program consist of statements which are executed sequentially, as decided by the programmer. Functional Programming differs from that in a fundamental way: algorithms are specified by means of equations and function definitions in a mathematical way (hence the term “functional programming”). The order in which an expression evaluated is decided by the computer itself, the programmer only specifies the functional relationships.
A functional program consists of a collection of function definitions in which self-defined functions may be used, and which together formulate a solution for a programming problem. This gives a strongly modular character to a functional program. Reasoning about a functional program, for example whether a program is correct, or whether two programs are equivalent, is well possible in a functional language because of the fact that such a language is referentially transparent, that is, a variable has the same value everywhere in a definition. Repetitive algorithms are expressed by means of recursion, which is strongly related to mathematical induction.
Important concepts that will be discussed in this course are, apart from recursion: list comprehension, higher order functions, data types, recursive types, lazy evaluation. The functional programming language chosen for this course is Haskell (see haskell.org).
Everything that can be programmed in an imperative, object-oriented language can also be programmed in a functional language. In a functional language one focusses more strongly on the essence of an algorithm which makes a functional program far shorter than an equivalent imperative program. Functional programming stimulates a higher level of abstraction in thinking about programming problems.
The importance in research and applications of functional programming is growing over the past few years, for example in the area of hardware design the role of functional languages is increasing (see, for example, clash-lang.org).
There will be lectures, self-study assignments and practical sessions, followed by homework assignments and a written exam which together determine the final mark.
Remark: lectures and practical sessions coincide with those in the module Programming Paradigms (201400537). This module is meant for bachelor students TCS, where the course on functional programming is available for other students, notably for students in the master program Embedded Systems. For this reason, the workload is not evenly distributed over the block and the course schedule is irregular. The final assignments may differ from the assignments in the module. Please contact the lecturer before registering for this course if you have questions about educational feasibility, scheduling or course contents.