Recent Changes · Search:

Functional Programming

Type Inference


  • (incorporates former Speagram)


Kurs Pascala

Artificial General Intelligence


Algorithmic Game Theory: Prediction Markets (po polsku)

Programming in Java

kurs pracy w systemie Linux

Evolutionary Algorithms


Data Stores and Data Mining

Language Understanding

Systemy Inteligentnych Agentów

Przetwarzanie Języka Naturalnego

Programowanie Funkcjonalne


add user

edit SideBar

Jump to the current lecture

The course will be taught in OCaml, with translations to F#. Most of the exercise solutions should be straightforward to translate between OCaml and F#.

Useful links:

Functional programming video lectures:

Lectures and assigned material

The time given is how many lecture-hours a lecture actually took us, for reference: don’t be scared that lecture 6 appears as a single lecture. One meeting is two lecture-hours.

  1. Lecture 1: Logic Δ (and Types). [2 hours]
    • Examples: Δ, Lec1.fs Δ.
    • For further practice, you can do lessons 1–4 of the tutorial at, and parts “Quick Language Overview” and “The Functional World” of the tutorial at Skip over the parts that you do not understand or that are too time-consuming. Unfortunately the F# tutorial wouldn’t work for me under Linux, but it works under Windows.
  2. Lecture 2: Algebra Δ (and Algebraic Data Types) (needs some fixes) — Lecture 2 Figure Δ. [2 hours]
  3. Lecture 3: Computation Δ. [2 hours]
  4. Lecture 4: Functions Δ (and Lambda Calculus). Also known as Alligator Calculus. (Lecture requires OCaml.) [3 hours]
  5. Lecture 5: Polymorphism and Abstract Data Types Δ. Type inference. Polymorphic recursion. Algebraic specifications. Maps. Red-black trees. [3 hours]
  6. Lecture 6: Generic functions, Lists. Δ Generic programming with mapping and folding. Backtracking with lists. [5 hours]
  7. Lecture 7: Laziness and Streams. Δ Lazy evaluation and stream processing. [3 hours]
  8. Lecture 8: Monads. Δ List comprehensions. Monads. The module system. Probabilistic Programming. Lightweight cooperative threads. [7 hours]
  9. Lecture 9: Compilation and Parsing. Δ Working with OCaml projects. Compiling and runtime of FPLs: Garbage Collection and closures. Optimization. Writing parsers in Menhir.
  10. Lecture 10: FRP. Δ Zippers. Adaptive Programming aka. Self-Adjusting Computation. Functional Reactive Programming i.e. temporal programming. GUIs.
  11. Lecture 11: the Expression Problem. Comparison of object-oriented and function-oriented program organization. Type system concepts for solving the Expression Problem. “Intellisense”. I might prepare lecture 11 this summer fall.
  12. Lecture 12: OCaml Standard Libraries. Batteries and Core.
  13. Lecture 13: Category Theory for Functional Programmer. Overview of Haskell’s standard library. Invitation to Category Theory. Theory of monads.
  14. Lecture 14: Parallelism. Sharing memory across processes, MPI, and more. I might prepare lecture 14 next year (2014).

Contact me if you would like to receive our exam exercise sets. They are based in half on 99 problems.

Working in the browser:

  • Tutorial OCaml toplevel running on client-side in JavaScript (compiled from OCaml bytecode by js_of_ocaml).
  • OCaml toplevel with the same js_of_ocaml-based engine.
  • OCaml toplevel running on client-side in Java plugin (compiled from OCaml sources by ocamljava).
  • online compiler/interpreter for several languages, running on server-side.

Installing on Windows:

  • OCaml student-friendly: OCaml Installer
    • The installer will also install Emacs. We will have several ways to use OCaml:
      • using the graphical toplevel OCamlWin.exe,
      • using any editor, e.g. OCamlBrowser, copying to the toplevel ocaml.exe and using the compiler ocamlc.exe,
      • using Emacs as we do under Linux.
    • Save Δ as .ocamlinit in a directory which OCaml will recognize (either “home” or where you start OCaml); or just # #use “path\to\”;; in the toplevel (where path\to is the directory in which you saved Δ).
  • OCaml developer-friendly: Wodi (based on GODI)
  • See also OCaml 4.0 Win readme.
  • F#: Visual F#

Installing on Debian-derived systems (e.g. Ubuntu):

  • OCaml:
    • $ sudo apt-get install ocaml
    • $ sudo apt-get install tcl8.5-dev tk8.5-dev (as suggested)
    • We do not need Batteries, so instead, save Δ as .ocamlinit in your home directory.
      • But if you really want Batteries, do: $ sudo apt-get install ocaml-batteries-included
      • and save Δ as .ocamlinit in your home directory, for OCaml Batteries Included to start automatically in the toplevel.
    • $ ocaml starts the toplevel.
    • Instal other tools and libraries as needed, in similar manner.
  • F#:
    • $ sudo apt-get install mono-devel mono-tools-devel libmono-winforms2.0-cil libmono-system-runtime2.0-cil
    • Download fsharp2.0-1all.deb (this is just one possibility…)
    • $ sudo dpkg -i fsharp2.0–1all.deb
    • $ fsharpi starts the toplevel.
    • If the toplevel fails, we try to install from sources:
    • I use Emacs with fsharp-mode, download from and follow instructions in the README file.
Edit · History · Print · Recent Changes · Search · Links
Page last modified on December 28, 2013, at 02:33 PM