Substitution makes a copy of a pattern, substituting new values for variables in the pattern.
The function subst performs a single substitution:
(subst new var pattern )
(subst 3 '?r '(* pi (expt ?r 2))) = (* PI (EXPT 3 2))
The function sublis performs multiple substitutions:
(sublis binding-list pattern )
(sublis '((?h . 5) (?w . 4)) '(* ?w ?h)) = (* 4 5)
If all variables have been substituted by constants, the result can be evaluated:
(eval (subst 3 '?r '(* pi (expt ?r 2)))) = 28.274333882308138
Contents    Page-10    Prev    Next    Page+10    Index