Kawa, the Javabased Scheme system
7.6 Quantities
As a superclass of numbers, Kawa also provides quantities.
A quantity is a product of a unit and a pure number.
The number part can be an arbitrary complex number.
The unit is a product of integer powers of base units,
such as meter or second.
Kawa quantities are a generalization of the quantities in DSSSL,
which only has lengthderived quantities.
The precise syntax of quantity literals may change,
but some examples are 10pt
(10 points), 5s
(5 seconds),
and 4cm^2
(4 square centimeters).
 Function: quantity? object
 True iff object is a quantity. Note that all numbers are
quantities, but not the other way round.
Currently, there are no quantities that re not numbers.
To distinguish a plain unitless number from a quantity,
you can use
complex?
.
 Function: quantity>number q
 Returns the pure number part of the quantity q, relative to
primitive (base) units.
If q is a number, returns q.
If q is a unit, yields the magitude of q relative to base units.
 Function: quantity>unit q
 Returns the unit of the quantity q.
If q is a number, returns the empty unit.
 Function: makequantity x unit
 Returns the product of x (a pure number) and unit.
You can specify a string instead of unit, such as
"cm"
or "s"
(seconds).
 Syntax: definebaseunit unitname dimension
 Define unitname as a base (primitive) unit,
which is used to measure along the specified dimension.
 (definebaseunit dollar "Money")

 Syntax: defineunit unitname expression
 Define unitname as a unit (that can be used in literals)
equal to the quantity expression.
 (defineunit cent 0.01dollar)
