Exercises for Week 09

Exercise 00

  1. The index of concepts for this week is in a separate chapter. Peruse it and make sure that its entries make sense to you (otherwise, click on them to check them out).
  2. The lecture notes start with updates (Chapter Lecture Notes, updates). Make sure to check them out regularly, as they reflect the development of the lecture.
  3. Do take the time to peruse the lecture notes of this week and to reproduce their OCaml content.

Mandatory exercises

Optional exercises

  • Exercise 17: computing the Cartesian product of four sets generically
  • Exercise 24: computing the Cartesian product of a list of sets

Exercise 41

  1. Using The logical counterpart of the map function for lists, from Week 08, i.e., list_andmap, implement a predicate that checks whether a given list only contains integers that lie between -16 and +16, exclusively.
  2. Using List.init, Random.int, and Random.bool, implement an OCaml function that, when applied, constructs a list of random length that contains random integers lying between -15 and 15, inclusively.
  3. Consider (1) the unit-test function for the implementation in Part a., (2) the implementation in Part a., (3) the unit-test function for the implementation in Part b., and (4) the implementation in Part b. How do these OCaml functions relate with each other?
  4. Using words like “developers” and “testers”, characterize the rôles of the people who implemented (1) the unit-test function for the implementation in Part a., (2) the implementation in Part a., (3) the unit-test function for the implementation in Part b., and (4) the implementation in Part b. Is there any overlap?

Version

Created [10 Jan 2023]

Table Of Contents

Previous topic

The polymorphic option type

Next topic

Index of concepts for Week 09