Common Lisp Package: UNIT-FORMULAS

README:

FUNCTION

Public

IDENTIFY-UNIT (UNIT)

Returns a keyword designating a physical quantity the unit is of, or nil if none can be identified , as only those directly defined can be.

QUERY-UNIT (UNIT)

Return a plist of unit value and unit exponents

Undocumented

CONVERT-UNIT (UNIT-FROM UNIT-TO)

REDUCE-UNIT (UNIT-DESCRIPTION)

Private

MAKE-ARGUMENT-LIST (IN-SPEC)

Eliminate constants and sort in-spec (same thing as create env above).

REDUCE-ARGUMENT-LIST (ARGS ARGLIST)

Take arguments and argument list and match them, returning a list of properly sorted argument values, and error if units don't match.

REPLACE-FORMULA-TERMINALS (FORMULA)

Take unitified environment and transform it into list passable to defun, with all units conversions in place.

UNITIFY-FORMULA-TERMINALS (FORMULA ENV)

Takes variable/constant bindings in env and replaces them in formula

VERIFY-FORMULA (FORMULA)

Takes unitified formula and returns it's return unit, if correct, signals error if not.

Undocumented

DIVIDE-UNITS (UNITS)

EXPT-UNITS (UNIT POWER)

MAKE-FORMULA-ENVIRONMENT (VARIABLE-SPECS)

MULTIPLY-UNITS (UNITS)

SQRT-UNITS (UNIT)

STRIP-CONSTANTS-FROM-SPEC (IN-SPEC)

MACRO

Public

DEFFORMULA* (NAME (&REST IN-SPEC) FORMULA-EXPRRESSION)

This creates a formula using positional arguments, with much less error checking. If wrong unit is passed it will still fail, because symbol will be passed to the formula.

MAKE-UNIT (VALUE UNIT-DESCRIPTION)

Makes an unit object with value and unit description. The second one is not evaluated.

Undocumented

DEFFORMULA (NAME (&REST IN-SPEC) FORMULA-EXPRESSION)

DEFINE-OPERATORS (&BODY OPERATORS)

DEFINE-UNITS (&REST UNIT-DEFINITIONS)

Private

Undocumented

DEFINE-FACTORS (UNIT &REST FACTOR-DEFINITIONS)

IMPORT-NOVAK-DERIVED (DEFINITIONS)

IMPORT-NOVAK-SIMPLE (UNIT DEFINITIONS)

GENERIC-FUNCTION

Public

Undocumented

DIMENSIONLESS-P (UNIT)

SAME-UNIT-P (UNIT1 UNIT2 &KEY FACTOR (FACTOR NIL))

SLOT-ACCESSOR

Private

VALUE-OF (OBJECT)

Value of constant, if constant

SETFVALUE-OF (NEW-VALUE OBJECT)

Value of constant, if constant

Undocumented

FACTOR-OF (OBJECT)

SETFFACTOR-OF (NEW-VALUE OBJECT)

NAME-OF (OBJECT)

SETFNAME-OF (NEW-VALUE OBJECT)

UNITS-OF (OBJECT)

SETFUNITS-OF (NEW-VALUE OBJECT)

VARIABLE

Public

Undocumented

*CONVERT-UNIT-BEHAVIOUR*

Private

*QUANTITIES*

List of symbols naming unit synonyms for base quantities

Undocumented

*BASE-UNITS*

*OPERATORS*

*UNIT-PRINT-LIST*

*UNITS*

CLASS

Private

Undocumented

UNIT

VARIABLE-WITH-UNIT