Matching and substitution can be combined to transform an input based on a rewrite rule: a list of an input pattern and an output pattern:
( (- (+ ?x ?y) (+ ?z ?y)) (- ?x ?z) )
(defun transf (rule input) ; simple version
(let (bindings)
(if (setq bindings
(match (first rule) input))
(sublis bindings (second rule))) ))
(match '(- (+ ?x ?y) (+ ?z ?y))
'(- (+ (age tom) (age mary))
(+ (age bill) (age mary))))
((?Z AGE BILL) (?Y AGE MARY) (?X AGE TOM) (T . T))
(transf '((- (+ ?x ?y) (+ ?z ?y))
(- ?x ?z))
'(- (+ (age tom) (age mary))
(+ (age bill) (age mary))))
(- (AGE TOM) (AGE BILL))
Contents    Page-10    Prev    Next    Page+10    Index