This repository contains all the source code for the exercise lectures for the 2014 edition of the Principles of Programming Languages course offered by Politecnico di Milano. Please refer to the course site for the lessons material.
- Basic scheme programming: if, cond, named let
- Recursion and tail recursion
- Lists
- Argument passing
- More on lists and vectors
- Structs
- Macro: simple examples, C vs. Scheme
- Macro: more advanced examples, C vs. Scheme (reprise)
- Continuations: break, continue, coroutines
- Basic Haskell programming: if, pattern matching, where
- Recursion and tail recursion
- Lists, list comprehensions, laziness
- Data types: intro and deriving, instance
- Folds
- Data types: ordered binary tree, with utility functions
- Functor and Foldable: generic map and fold for new data types
- Monads: Monad class, Maybe and the phonebook example
Functors, applicatives and monads in pictures (tutorial)
- Monads: instantiating a Monad and creating utility methods
- Create a new Logger Monad and reimplement the Tree methods to take advantage in it
- (Very) brief examples of Monads in Scala
Please note: I have included today's slides with the project description, but refer to the course site for the updated version.
- Introduction and brief history
- Functional Erlang
- Examples on basic syntax, recursion and tail recursion, higher order functions
- The binary tree, Erlang style
Please note: there is no need for a specific Erlang version, any version from (at least) 14 to 17 should be enough for our examples.
Each function is preceded by the specification of parameters and return value types: while this is not as precise as in languages like Haskell, and it does not given any information to the compiler (so there is not compile time checking, Erlang being a dynamically typed language), these specifications are supported by an Erlang tool called Dialyzer, which analyzes an application and checks (with limitations) if the input and output types are correct. It is also useful from a readability point of view, and when (Javadoc-like) documentation is generated.
- Concurrent Erlang: the actor model
- Basic process syntax, fundamentals of fault tolerance
- Distributed Erlang: nodes and networks
- Examples
- Haskell: concurrency, threads and shared data
- Prolog: genealogy example, list manipulation, combinations
- Other examples treating Prolog as a functional language: fold, binary trees
- Solve problems: Tower of Hanoi, 8 queens, Sudoku