YSC1212 Lecture Notes, Week 09
- Reversing lists
- Programming using accumulators
- Generic programming with lists
- Resources
- Structural recursion over lists
- Example: computing the length of a list, generically
- Example: unparsing a polymorphic list in long hand, generically
- Example: unparsing a polymorphic list in short hand, generically
- Example: duplicating the elements of a list, generically
- Example: concatenating two lists, generically
- Example: list membership, generically
- Exercise 7
- Sets as lists, re2visited
- Exercise 8
- Solution for Exercise 8
- Exercise 9
- Exercise 10
- Exercise 11
- Example: the Cartesian product of two sets, generically
- Example: the Cartesian product of three sets, generically
- Exercise 12
- Structural recursion over lists using an accumulator
- Example: computing the length of a list using an accumulator, generically
- Exercise 13
- Sets as lists, re3visited
- Exercise 14
- Solution for Exercise 15
- Exercise 16
- Exercise 17
- Exercise 18
- The map function for lists, generically
- Aftermath
- Exercise 19
- Exercise 20
- Postlude
- Resources
- Version
- The Art of Computer Science
- Concrete data types
- Polymorphic binary trees in OCaml
- Generic programming with binary trees
- Exercises