## 7.7.6 Tagged maps

Page 202 of 800 |
| Search internet |

Consider the construct defined thus:

The construct takes a raw map x as input and returns a tagged map as output. the constant named MapTag is defined such that it happens to have the following value:

The exact value of MapTag is unimportant. And why that particular value was chosen is also unimportant. What counts is that Booleans, pairs, exceptions, integers, tagged maps, and objects have different tags and thus are distinguishable.

Note that mathematicians often talk about 'colors' instead of 'tags'. As an example, mathematicians may think of the direct sum of integers and rationals as a union of integers that are colored blue and rationals that are colored red.

It is stated above that takes a raw map x as input and returns a tagged map. Recall that 'raw map' is a synonym for 'map'. So we could just as well state that takes a map x as input and returns a tagged map.

Note that a tagged map is itself a map. Put otherwise, the set of tagged maps constitutes a subset of the set of all maps. There is a one-one relation between the set of maps and the set of tagged maps, and constitutes an isomorphism between the two sets.

Maps are suited for lazy evaluation and tagged data are suited for eager evaluation. The construct does not force evaluation of x and can be used for embedding lazy data inside eager data structures. Embedding the other way is trivial since the set of tagged data is a subset of the set of maps.

Page 202 of 800 |
| Search logiweb.eu |

Copyright © 2010
Klaus Grue,
GRD-2010-01-05