Case Study: Immutable Finite Functions, Part 1

In this case study, we design and implement an immutable abstract data type of finite functions.

Our first implementation of that abstract data type will represent a finite function as a list of objects, each of which represents a key and its associated value. We will refer to these representations as association lists, or alists.

To reduce duplication of code, we will define an abstract base class for association lists. That base class will define methods that can be shared by all subclasses that represent an alist, and it will declare abstract methods that need to be defined differently within each subclass.


Creative Commons License © William D Clinger, 2017
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.