next up previous contents
Next: 5.2.4 Union Types Up: 5.2 More About Types Previous: 5.2.2 Canonicalization

5.2.3 Member Types

 

The  member type specifier can be used to represent ``symbolic'' values, analogous to the enumerated types of Pascal. For example, the second value of find-symbol has this type:

(member :internal :external :inherited nil)
Member types are very useful for expressing consistency constraints on data structures, for example:
(defstruct ice-cream
  (flavor :vanilla :type (member :vanilla :chocolate :strawberry)))
Member types are also useful in type inference, as the number of members can sometimes be pared down to one, in which case the value is a known constant.



Raymond Toy
Mon Jul 14 09:11:27 EDT 1997