arithmetic/tests.lisp
The historical :affine-p spelling still means point, and an explicit :affine-p nil on a declared point yields a difference of that quantity.
A derived difference is anonymous-in-character but named, so it no longer promises non-negativity.
A bare number is a scale factor and preserves the other character.
No other character crossing is an interpretation.
(name &key kind components non-negative-p
(character nil character-supplied-p))Define quantity NAME and any homogeneous COMPONENTS as members of KIND. NON-NEGATIVE-P declares a non-negative amount and defaults its character to :ABSOLUTE. CHARACTER may state :POINT, :ABSOLUTE, or :DIFFERENCE explicitly. Components inherit both.
(name value &key type quantity documentation)Define an ordinary constant which publishes its represented quantity. The runtime value remains the unwrapped result of VALUE. TYPE states its Common Lisp representation independently of QUANTITY's semantic declaration; VALUE-DECLARATION-FOR retrieves the latter at definition boundaries.
PROPERTY: VALUES; -- the property a keyword, the values a list written space-separated.
(name)Return the represented-value declaration published by global NAME, or NIL.
Test whether two compatible scalars are equal.
(declaration)Return DECLARATION's backend or Common Lisp representation type, or NIL.
(declaration)Return DECLARATION's homogeneous quantity specification, or NIL.
(left right)(&optional designator)Return a canonical dimension from NIL, one base symbol, or factor pairs. Each factor pair has the form (BASE EXPONENT), where EXPONENT is rational.
(numerator denominator)(left right)(dimension)(dimension exponent)(name &key (dimension nil dimension-supplied-p) unit
(tensor-order 0)
(affine-p nil affine-p-supplied-p)
(character nil character-supplied-p))(operator &rest operands)Derive the semantic result of applying OPERATOR to quantity OPERANDS.
Addition over compatible quantities.
Subtraction or unary negation.
(specification)Logical negation of one test or raw truth value.
Multiplication and scalar scaling.
(left right)Division of two represented quantities.
(source target)(source target-unit)Return SOURCE expressed in TARGET-UNIT and its required numeric factor. The operation preserves semantic name, dimension, tensor order, and affine character. It is a linear unit conversion, not a semantic interpretation.
(unit)(&optional designator)Return a canonical unit expression from NIL, a defined unit, or factors. Every symbolic factor must have a semantic unit definition. Exact unit identity remains visible here; conversions are requested separately.
The maximum of compatible quantities.
Constrain a quantity between compatible bounds.
Interpolate compatible quantities by a scalar amount.
(specification &optional tensor-order)Compare compatible quantities and produce dimensionless values.
Produce dimensionless progress across compatible edges.
Normalize a dimensionless vector.
Raise a dimensionless value to a dimensionless power.
(quantity-name)How the children of a list are arranged.
(extent projections)(positions specification)(specification positions extent)Derive the quantity selected from a homogeneous represented quantity. Selecting every position in order preserves the whole. A single component of an anonymous quantity remains anonymous. A named quantity must explicitly publish ordered component names; no default silently calls one axis the whole.
(layout positions)(left right)A block-level piece of an Org document.
(element-layout &key stride)(options &key (default-tensor-order 0))Parse one source declaration plist into a quantity specification. Return NIL when OPTIONS contains no quantity attributes. This is the common source seam used by arithmetic parameters, shader interfaces, and semantic storage declarations; callers retain ownership of their source-specific error conditions and…
(&key representation-type quantity-specification quantity-layout source-form)(declaration)Return DECLARATION's heterogeneous quantity layout, or NIL.
(declaration)(declaration)Return the source form which established DECLARATION.
(actual expected)Require ACTUAL storage to satisfy EXPECTED represented-value meaning. Quantity specifications and layouts agree exactly. A NIL expected representation leaves representation choice open; otherwise ACTUAL's Common Lisp type must be a known subtype. Return ACTUAL on success. #GZ53LD
(derived interpretation)Give a compatible anonymous DERIVED specification an explicit meaning. This is a semantic interpretation, never a numerical unit conversion. An already named quantity may only retain its name; anonymous derived results may acquire one when their dimension, exact unit, and tensor order agree with INTERPRETATION. …
(operator &rest specifications)(specification)(specification)Whether SPECIFICATION's named definition declares a non-negative amount. Only a named absolute can promise this; anonymous derived results never do.
(specification)The two-way split above is mp-units V2, and it is what affine-p in arithmetic/semantics.lisp implements today: a specification is either a point or a difference. mp-units V3's central discovery (#QFCPRA) is that this misses the commonest case. Most physical equations are written over absolutes: non-negative amounts…
The three-way affine character: point, absolute, difference. These are the executable claims of the V3 operation table in wiki figure #LNRY72.