July 2023
Intermediate to advanced
670 pages
17h 13m
English
So far in this book, you’ve learned how to use polymorphism to create data structures and functions that can work with many different types. In all of the examples you’ve worked through so far, you’ve had to select a single type for any given instance of a polymorphic type. For example, while you can create a list that can hold any type, once instantiated, that list is restricted to only holding values of that one specific type that you selected.
In some cases, having data structures that are restricted to being uniform in the type they can hold can be quite inconvenient. In these situations, we turn to heterogenous data structures, which can hold values from an arbitrary collection of types. One particularly common ...