| Lesson
3:
Types
Increment
1:
Type Functions and
Predicates.
Start Quantum again and
reproduce what you see in the Quantum session below.
Every Quantum object has a
unique immutable basic type returnable by function Type.
Types categorize Quantum objects and, being Symbol's,
are type Symbol.
Types can be subtypes of more general types. For example, all Float's
are Real's,
all Real's
are Number's,
etc. as revealed by Quantum's functions TypeParent
and SubtypeP. The most general
type is Object.
Use TypeCase to dispatch by
object type, TypeP to type
test without error, and TypeCheck
to type test with error. |