Browse Source

Rewrite introduction to expression types

Samuel W. Flint 5 years ago
parent
commit
c0173c6f2b
1 changed files with 2 additions and 2 deletions
  1. 2 2
      larcs.org

+ 2 - 2
larcs.org

@@ -72,9 +72,9 @@ While the [[id:f3e3cdb9-a661-4598-8be1-e15f587f35bb][Introduction]] describes th
 :ID:       fe611e8f-db42-4fe0-8e77-9cfb55d2227c
 :END:
 
-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]].
+Expressions and Algorithms provide the backbone of LARCS.  Expressions are organized into a variety of types (see Figure [[fig:expression-types]]), fundamentally deriving from the ~<expression>~ type.  Expressions exhibit several properties in common, including equality (through ~eqal~, which, if unable to find given the original order, will try to find a definition for the reverse order), copyability (~copy-expression~), substitutability (~substitute-expression~, replaces ~replace~ with ~replacement~ in ~expression~), evaluability (~evaluate~), and conversion to s-expressions (~to-sexp~, when ~resolve-constants-p~ is true ~<constant>~ objects are replaced by their numerical values).
 
-Note that ~eqal~ will handle ~type-error~ by trying to switch the order of the arguments.  If this fails, it will warn that an applicable method for the given types, and return ~nil~.
+Evaluability is the most complex of these properties, it is accomplished with ~evaluate~.  Evaluate takes an expression, a list of substitutions (pairs of expressions of the form ~(replace . replacement)~) and one of two keyword arguments, ~:resolve-constants-hard-p~ which will cause constants to be treated as ~<number>~ objects, and ~:resolve-constants-light-p~ which will treat them as variables.  Note, that in many cases, carefully chosen replacements will help, but one of the above /must/ be specified.
 
 #+Caption: Basic Expressions Types
 #+Name: type-basic