From the Lukasz Stafiniak pages

Functional: Functional

Jump to the current lecture

This is a course on Functional Programming in OCaml [1]. It focuses on functional programming ideas, rather than pragmatic OCaml programming. Lectures 1 to 6 may appear overwhelming as they introduce many concepts. In fact, the algorithmic content of lectures 1–6 is for the most part quite simple, but I wanted them to force the students to think from scratch. Concepts from lectures 7, 8, 10 are more prevalent in Haskell, because OCaml programmers can judiciously use imperative features to avoid introducing complexity. In particular, monadic programming has better optimization support in Haskell than in OCaml. Lecture 9 (and lectures 12, 14 to come) address the pragmatics of OCaml programming directly. To be a well-rounded functional programmer, you should also complete a complementary course based on the book Pearls of Functional Algorithm Design by Richard Bird. Or you can intersperse reading Pearls of Functional Algorithm Design with following this course. (Perhaps I’ll do something about it.)

Initial lectures have examples translated to F# [2], but then I decided to focus on OCaml.

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: Attach:Lec1.ml, Attach:Lec1.fs.
    • For further practice, you can do lessons 1–4 of the tutorial at http://try.ocamlpro.com/, and parts “Quick Language Overview” and “The Functional World” of the tutorial at http://www.tryfsharp.org/. 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 [21]. (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.
    • This lecture is OCaml-specific, and least functional-programming-ish in the course.
    • Examples:
    • Exercises.
    • Reading the generated assembly [27] — compiling with ocamlopt -S.
    • Writing Performance Sensitive OCaml Code [28]
    • New: capnp-ocaml 2.0: The Road to Unembarrassing Performance [29] — a blog post about optimizing an OCaml serialization plugin.
  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. Type system concepts for solving the Expression Problem with introduction to OCaml’s objects and classes. Monadic parsing and dynamic code loading.
    • Examples: Attach:Lec11.zip.
    • Exercises.
    • Ralf Laemmel lectures on MSDN’s Channel 9: The Expression Problem [38], Haskell’s Type Classes [39].
    • Developing Applications With Objective Caml. Chapter 15: Object-Oriented Programming [40], Chapter 16: Comparison of the Models of Organisation [41].
    • Real World OCaml. Chapter 11: Objects, Chapter 12: Classes.
    • Jacques Garrigue: Code Reuse Through Polymorphic Variants [42], Structural Types, Recursive Modules, and the Expression Problem [43].
    • Graham Hutton and Erik Meijer: Monadic Parser Combinators.
  12. Lecture 12: Standard Libraries. Haskell’s type classes. OCaml’s alternatives Batteries and Core, and Haskell Hierarchical Libraries.
  13. Lecture 13: Category Theory for Functional Programmer. Invitation to Category Theory.
  14. Lecture 14: Parallelism. Sharing memory across processes, MPI, and more.

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

Working in the browser:

Installing on a desktop:

The instructions below are outdated. Go to ocaml.org / Install OCaml [48] if you do not have OCaml working yet.

Installing on Windows:

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

Copyright © 2005–2006 the Main wiki and its authors

Links

  1. ocaml.org
  2. research.microsoft.com/en-us/um/cambridge/projects/fsharp
  3. typeocaml.com
  4. ocaml-book.com/videos
  5. www.typerex.org/ocaml-top.html
  6. www.ocaml.org/index.html
  7. www.ocaml.org/tutorials
  8. www.ocaml.org/tutorials/99problems.html
  9. www.haskell.org/haskellwiki/H-99:_Ninety-Nine_Haskell_Problems
  10. aperiodic.net/phil/scala/s-99
  11. caml.inria.fr/pub/docs/oreilly-book
  12. ocamlunix.forge.ocamlcore.org/index.html
  13. caml.inria.fr/pub/docs/manual-ocaml
  14. thelema.github.com/batteries-included/hdoc/index.html
  15. search.ocaml.jp
  16. blogs.msdn.com/b/dsyme/archive/2008/09/01/the-f-operators-and-basic-functions.aspx
  17. channel9.msdn.com/Series/C9-Lectures-Erik-Meijer-Functional-Programming-Fundamentals/Lecture-Series-Erik-Meijer-Functional-Programming-Fundamentals-Chapter-1
  18. www.cs.nott.ac.uk/~gmh/book.html
  19. channel9.msdn.com/Tags/ralf-laemmel
  20. www.youtube.com/playlist?list=PLey3KIETJDP-6dIBWfFWjKkz4AC88qN7t
  21. worrydream.com/AlligatorEggs
  22. www.youtube.com/watch?v=fclvsoaUI-U#t=40m52s
  23. okmij.org/ftp/kakuritu
  24. lambda.jimpryor.net/state_monad_tutorial
  25. lambda.jimpryor.net/monad_transformers
  26. www.cas.mcmaster.ca/~carette/pa_monad
  27. ocaml.org/tutorials/performance_and_profiling.html
  28. janestreet.github.io/ocaml-perf-notes.html
  29. pelzlpj.github.io/capnp-ocaml/2014/09/02/capnp-ocaml-2.0
  30. en.wikibooks.org/wiki/Haskell/Zippers
  31. ambassadortothecomputers.blogspot.com/2010/05/how-froc-works.html
  32. caml.inria.fr/pub/docs/manual-ocaml/manual042.html
  33. www.cs.uiuc.edu/class/sp07/cs421/resources/labltk
  34. lablgtk.forge.ocamlcore.org
  35. ocaml.org/tutorials/introduction_to_gtk.html
  36. plus.kaist.ac.kr/~shoh/ocaml/lablgtk2/lablgtk2-tutorial
  37. www.umut-acar.org/self-adjusting-computation
  38. channel9.msdn.com/Shows/Going+Deep/C9-Lectures-Dr-Ralf-Laemmel-Advanced-Functional-Programming-The-Expression-Problem
  39. channel9.msdn.com/Shows/Going+Deep/C9-Lectures-Dr-Ralf-Lmmel-Advanced-Functional-Programming-Type-Classes
  40. caml.inria.fr/pub/docs/oreilly-book/html/book-ora138.html
  41. caml.inria.fr/pub/docs/oreilly-book/html/book-ora151.html
  42. citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.38.8079
  43. www.cs.ox.ac.uk/ralf.hinze/WG2.8/22/slides/jacques.pdf
  44. www.ocaml.org/tutorials/99problems.html
  45. try.ocamlpro.com
  46. ocsigen.org/js_of_ocaml/files/toplevel/index.html
  47. ocamljava.x9c.fr/toplevel/toplevel.html
  48. ocaml.org/docs/install.html
  49. protz.github.com/ocaml-installer
  50. wodi.forge.ocamlcore.org
  51. godi.camlcity.org/godi/index.html
  52. caml.inria.fr/pub/distrib/ocaml-4.00/notes/README.win32
  53. msdn.microsoft.com/en-us/vstudio/hh388569
  54. www.microsoft.com/download/en/details.aspx?id=11100
  55. fsxplat.codeplex.com/downloads/get/166083
  56. log.kevincantu.org/2011/09/f-on-ubuntu-oneiric-building-f-from.html

Retrieved from http://ii.uni.wroc.pl/~lukstafi/pmwiki/index.php?n=Functional.Functional

Page last modified on July 06, 2015, at 09:45 PM