Substitution

The function SUBST makes a new S-expression tree (not just a list) with a specified substitution.

(SUBST x y z) means ``substitute x for y in z''.


(SUBST 'JONES 'NAME '(DEAR MR NAME))

           =  (DEAR MR JONES)


(SUBST 5.0 'RADIUS
           '(* 3.14159 (EXPT RADIUS 2)))

           =  (* 3.14159 (EXPT 5.0 2))


(SUBST 'SOCRATES '?X
       '(IF (HUMAN ?X) (MORTAL ?X)))

           =  (IF (HUMAN SOCRATES)
                  (MORTAL SOCRATES))

Contents    Page-10    Prev    Next    Page+10    Index