Exercises and assignments for COMP3400 (Functional Programming1). Done in Semester 1, 2021 with lectures presented by Paul Vrbik.
Assignments were relatively straightforward, with few questions. Where able, they were solved with great overcomplication and functional programming arcana ^_^
- a1: easy implementation of elementary higher-order functions, and a simple digit manipulation exercise.
- a2: arrangement of tiles in a 2d grid with translation/rotation, brute-force propositional logic tautology checker (using Free monad), and structural pattern matching for lists (?).
- a3: recursive tree traversal for maximum path within binary tree, and reimplementing a list.
- a4: poker hand determination, Potato game solving.
The course used Exercism for weekly exercises, some were given each week as homework. All the exercises completed are in the exercism folders.
These were, at times, quite interesting. We had motivation and freedom to explore the abstractions of Haskell.
A few highlights are:
- DNA: most simple use of traverse in parsing, fascinating in your first weeks of Haskell.
- Brackets: matching paired brackets in a string, a recursive algorithm with an implementation using foldr.
- Yacht: scoring a mildly interesting dice game.
- Dominoes: arranging dominoes such that they form a cycle.
- Deque: doubly-linked list using mutable state and IO.
- Garden: more complex parsing and logic to process input with transposition (also has a playground with Foldable and Applicative!).
Footnotes
-
Nominally, the course also covers logic programming, but this hasn't happened for several years. ↩