AFP

Functional Approaches to Programming
The functional programming paradigm is very ancient, grounded in solid theoretical foundations, yet much less popular than the object-oriented one, although it has gained momentum in the past two decades. This course presents the functional programming paradigm in the broader sense, that is, not limited to the purely functional version. For illustration purposes, we use two languages in parallel: Lisp (the father of the paradigm) and Haskell (a more recent one). Both of these languages are functional, yet completely different in practically every aspect. This is precisely what makes their juxtaposition interesting.
We study the historical context in which the paradigm was born, the applicative principles it offers (primarily higher order functions), and the different language contexts in which this paradigm can be integrated: static vs. dynamic typing, pure or impure (with or without side effects), and with applicative or normal order evaluation.
Chapter 0: Introduction
- History, evolution, and development of the paradigm: Lisp and the lambda-calculus, other languages. Comparison with imperative programming. Caracteristics of the functional approach: higher ordre, pure or impure functional programming (with or without side effects), evaluation schemes (normal or applicative order).
- Slides (fr, en)
Chapter 1: Lisp and Haskell
- Differences tutorial: syntactic elements, concept of “expression” and “evaluation”, interactivity. Dynamic and static typing. Conditionals, arithmetics, lists. Homoiconicity, reflexivity, meta-programming. Final comparison: 4 traits of the functional approach on the Newton-Raphson example.
- Slides (fr, en), code companion
Chapter 2: Higher Order Functions
- Reminders and generalities: definition, naming, assignment, locality. Anonymous functions. Functional arguments and design patterns: mapping, filtering, folding (reduction). Functional return values and design patterns: composition, operator cut, partial application. Functional objects: functional data structures and the relationship with the object-oriented paradigm.
- Slides (fr, en), code companion
Chapter 3: Evaluation and Scoping
- Evaluation schemes: normal and applicative orders, consequences on the languages semantics. Lexical and dynamic scoping, bloc structure, locality, lexical closures, hygiene, name capture and name clash.
- Slides (fr, en), code companion)