Tentative plan for 02157 Functional Programming (Autumn 2024)

Teacher: Michael R. Hansen.

Textbook: Functional Programming using F#, Michael R. Hansen and Hans Rischel, Cambridge University Press, 2013. (Abbreviated HR.)

Week Date Topic Read Exercises
36   6. Sept. Course introduction
Intro. to functional programming and F#
Lists (brief introduction)
HR 1, HR 2.1-2.6, HR 4.1-4.3 Installation of F# and first programs
See Material folder on DTU Learn
37   13. Sept. Functions, Basic types, Tuples and Lists
HR 2, HR 3.1-3.3, 3.5, 3.6
HR 4.1 - 4.4
  1. HR 1.5, HR 2.2, 2.8, HR 4.7
  2. Mini-project on polynomials: Part 1
    See Material folder on DTU Learn
38 20. Sept. Programming as a model-based activity
Property-based testing - Briefly
HR 3.4-3.7, HR 4
  1. HR 2.1, 4.3, 4.8, 4.9, 4.12
  2. Consider your solution to 4.7 and make an evaluation of 'multiplicity 2 [1; 2; 8; 2]'
  3. Exercise on polynomials: Part 2. You may also consider/start on Part 3
  4. Paper and pencil exercises: HR 4.16, 4.17
  5. Write F#-programs having the types (1) bool -> bool, (2) int -> int -> int, (3) 'a -> 'b -> 'a and (4) 'a -> ('a -> 'b) -> 'b
  6. Merge sort. A program to generate random lists is here
39 27. Sept. Disjoint union (Tagged values)
Higher-order list functions On types for functions - briefly
HR 3.8-3.11, HR 5.1
  1. Paper and pencil exercises: HR 4.18. Give an argument for the type of f.
  2. SimpleCompanyClub.
  3. AirportProblem.pdf
  4. Exercise on polynomials: Part 3. you may also consider starting on Part 5 (invariant checking).
40 4. Oct. Lecture slot: Recap of fundamental concepts
Selected old exam questions will be handed out (on Learn).
  • Should be solved using paper and pencil only
  • Solutions will be presented.
  1. HR 5.3
  2. Make a revised version of the Cash register example in Section 4.6 where:
    1. The function findArticle is replaced by an application of List.tryFind
    2. The function makeBill is declared using List.foldBack
  3. Map coloring: validation of properties
  4. Polynomial exercise: Part 4. Thereafter, you can complete Part 5.
41 11. Oct. Collections: Sets and Maps

From 11:10 - 12:00: Functional Programming in the Wild
Guest lecture by Torben Hoffmann
VP, Business Unit Lead for Erlang Solutions London, a Trifork company
HR 5.2-5.3
  1. Solve the Airport problem from Week 4 using functions from the List-library, whenever that is appropriate.
  2. Solve the following two problems from old exams, where you should start with solutions based on "plain" recursive functions. Provide, thereafter, solutions to questions using functions from the List library, when that makes sense.
    1. Problem 2 from Exam, Summer 2015.
    2. Problem 1 from Exam, Fall 2013. Question 6 can be solved when the topic Map has been studied.
    Old exams can be found here
42 18. Oct. Autumn vacation
43 25. Oct. Modules
Type inference shortly
HR 7
  1. Revise your solution of the simple company club problem (Week 39) using sets and maps whenever that is appropriate.
  2. Problem 1 from Exam, Fall 2013.
  3. Problem 1 from Exam, Fall 2015.
    Old exams can be found here
44 1. Nov. Finite trees (I) HR 6
  1. Part 6 of exercise on polynomials
  2. Week8.pdf
  3. Part 1 from Mini-project 2: Simple Compiler. See Material folder on DTU Learn.
45 8. Nov. Finite trees (II)
HR 6
  1. File System
  2. Mini-project 2: Simple Compiler. See Material folder on DTU Learn.
46 15. Nov. Tail recursion HR 9
  1. Week10.pdf
  2. Complete the simple-compiler miniproject.
  3. Start on the mini-project on propositional logic
47 22. Nov. Sequences
Property-based testing shortly
HR 11
  1. Summer exam 02157-2014, Problem 1(1,2,3) -- available here
  2. Fall exam 02157-2014, Problem 2(4,5) -- available here
  3. Week11.pdf
Continue with mini-project on propositional logic.
48 29. Nov. Verification shortly
TBA
  1. 11.1 and 11.9
  2. CollatzConjecture.pdf
  3. Week12.pdf
  4. Summer exam 2014, Problem 1(4,5) -- available here
  5. Fall exam 2014, Problem 2(1,2,3) -- available here
49 6. Dec. TBA


Michael R. Hansen, Nov. 15, 2024