arithmetic/lisp/compiler.lisp
Apply scalar function componentwise to two Lisp representations.
Apply scalar function componentwise to one Lisp representation.
Return the ordinary Lisp function name implementing operator.
Scalar lowering. The generic realization above dispatches on numbers versus vectors at run time so one compiled function can serve every representation. A hot loop whose operands are known scalars wants the ordinary Common Lisp operators instead, so that declared integer or float types flow through the emitted arithmetic. The choice is made once, by the caller lowering an expression, and never per operation.
How lower-lisp-arithmetic-expression emits calls: :GENERIC uses the
representation-dispatching lisp-add family; :SCALAR emits CL operators over
declared scalar operands. #53Q1II
Return the scalar Lisp form applying operator to lowered scalar operands.
Define operator's scalar lowering from its lowered operand forms.
Lower checked expression to ordinary Lisp using target-to-name environment.
Construction, assumption, interpretation, and representation are all compile-time semantic boundaries. Their runtime representation is the operand itself.
Lower a checked arithmetic definition or its symbolic name to a lambda.
Define checked arithmetic name as both semantic source and a Lisp function.
Compile a checked arithmetic definition or symbolic name to a function.
One checked arithmetic definition compiled for explicit Lisp types.
Compile definition and state the Lisp representations chosen for its ABI.
Check one storage ABI against realization and return its raw Lisp function.
One top-level defining form of a source file.
Logical conjunction of tests and raw truth values.
(left right)Test whether two compatible scalars are equal.
(function vector)(function left right)(function left right)Apply scalar FUNCTION componentwise to two Lisp representations.
(function value)Apply scalar FUNCTION componentwise to one Lisp representation.
(function operands identity)(&rest operands)Addition over compatible quantities.
(&rest operands)Subtraction or unary negation.
(&rest operands)Multiplication and scalar scaling.
(&rest operands)Division of two represented quantities.
(&rest operands)The minimum of compatible quantities.
(&rest operands)The maximum of compatible quantities.
(value)The componentwise absolute value of a raw value.
(value)The componentwise square root of a raw value.
(base exponent)Raise a dimensionless value to a dimensionless power.
(left right)(value lower upper)(from to amount)(number)Convert one scalar float or unsigned value to a 32-bit float.
(number)(edge value)Test whether one compatible scalar is less than another.
(lower upper value)(vector)(operator)Return the ordinary Lisp function name implementing OPERATOR.
(operator function)The non-negative remainder of integer division.
The inner product of two vectors.
Constrain a quantity between compatible bounds.
Interpolate compatible quantities by a scalar amount.
Produce dimensionless progress across compatible edges.
Compare compatible quantities and produce dimensionless values.
Normalize a dimensionless vector.
Test whether one compatible scalar is at most another.
Test whether one compatible scalar is greater than another.
Test whether one compatible scalar is at least another.
Logical disjunction of tests and raw truth values.
Logical negation of one test or raw truth value.
How LOWER-LISP-ARITHMETIC-EXPRESSION emits calls: :GENERIC uses the representation-dispatching LISP-ADD family; :SCALAR emits CL operators over declared scalar operands. #53Q1II
(expression environment)Lower checked EXPRESSION to ordinary Lisp using target-to-name ENVIRONMENT.
(operator operands)Return the scalar Lisp form applying OPERATOR to lowered scalar OPERANDS.
(operator lambda-list &body body)(target environment expression)(target)Return the source name denoted by reference TARGET.
A value conditional shared by every arithmetic realization.
One inspectable application of shared function source to checked values.
A lexical alias binding one function argument inside an application.
A bounded value-producing fold over an index and one carried state. The binding list is (INDEX COUNT STATE INITIAL), optionally followed by :UNTIL TEST, whose TEST sees INDEX and STATE and ends the fold early.
(name)Return the live arithmetic definition named by NAME, or NIL.
(definition)Lower a checked arithmetic definition or its symbolic name to a lambda.
A checked arithmetic source definition awaiting an execution backend.
(name parameters &body body)(name parameter-forms body)(name parameters &body body)(definition)Compile a checked arithmetic definition or symbolic name to a function.
One checked arithmetic definition compiled for explicit Lisp types.
(definition &key parameter-representation-types result-representation-type)(&key representation-type quantity-specification quantity-layout source-form)(realization actual-parameter-declarations
&key actual-result-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
The proposed frontier language is a DSL compiler, not a generic worklist framework whose inner loop depends on accidental devirtualization. A live, inspectable program definition remains open to Common Lisp development; one compilation closes that definition over particular fields, domains, neighborhoods,…
Common Lisp realization of backend-neutral compiled arithmetic.
Semantic checking has already happened in
luv.ARITHMETIC.LANGUAGE. This file erases quantity boundaries into ordinary numerical code and compiles the resulting lambda. Runtime values are numbers and vectors, never quantity wrappers.