|
All expressions are built from various ~<expression>~ objects. These objects are specialized to contain only certain, specific information, relevant to a particular expression. The most basic expressions (besides expression itself) are ~<atomic>~ (holding things like numbers or variables) and ~<compound>~ (holding things like multiplicatinos, divisions, exponents, trigonometric expressions, arithmetic expressions, /etc./). All subtypes of ~<expression>~ must know if they are atomic, so we define a generic for this, they must also tell if they are ~eqal~ (a form of equality), and be able to perform substitution, evaluation, and simplification, however, the latter three are implemented elsewhere. The organization of the various types may be found in Figure~[[fig:expression-types]].
|
|
All expressions are built from various ~<expression>~ objects. These objects are specialized to contain only certain, specific information, relevant to a particular expression. The most basic expressions (besides expression itself) are ~<atomic>~ (holding things like numbers or variables) and ~<compound>~ (holding things like multiplicatinos, divisions, exponents, trigonometric expressions, arithmetic expressions, /etc./). All subtypes of ~<expression>~ must know if they are atomic, so we define a generic for this, they must also tell if they are ~eqal~ (a form of equality), and be able to perform substitution, evaluation, and simplification, however, the latter three are implemented elsewhere. The organization of the various types may be found in Figure~[[fig:expression-types]].
|
|
Of the various types, there are three atomic types, ~<number>~, ~<variable>~ and ~<constant>~ They are very similar, only differing on the ~:type~ their value slot has. As all ~<atomic>~ subtypes are, in fact, atomic (save for some later blended types), we can simply return ~t~ for ~atomicp~. Further, all ~<atomic>~ have a definite value, so we should be able to retrieve this.
|
|
Of the various types, there are three atomic types, ~<number>~, ~<variable>~ and ~<constant>~ They are very similar, only differing on the ~:type~ their value slot has. As all ~<atomic>~ subtypes are, in fact, atomic (save for some later blended types), we can simply return ~t~ for ~atomicp~. Further, all ~<atomic>~ have a definite value, so we should be able to retrieve this.
|
|
~<constant>~ is a bit different from the rest -- it has a name, as well as a number, and the value depends on whether or not you want to "resolve" the constant. If the constant is to be resolved, the numeric value is returned, otherwise, the name is returned.
|
|
~<constant>~ is a bit different from the rest -- it has a name, as well as a number, and the value depends on whether or not you want to "resolve" the constant. If the constant is to be resolved, the numeric value is returned, otherwise, the name is returned.
|