9TUPLES AND TYPE CONSTRUCTORS

Image

A tuple is an ordered collection of values. There are tuples for ordered pairs, ordered triples, ordered quadruples, and so on. The types of the values in a tuple are generally different, but they could be the same.

In this chapter, we’ll discuss tuples and their generalization: the type constructor. Function types, list types, and tuple types are all examples of type constructors. We’ll present a unified way to think about these type constructors, which on the surface appear different, but all share essential features. Finally, we’ll revisit numerical integration to show how tuples, in conjunction with iteration, ...

Get Learn Physics with Functional Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.