(match '(- (+ ?x ?y) (+ ?z ?y))
'(- (+ (age tom) (age mary))
(+ (age bill) (age mary))))
=> ((?Z AGE BILL) (?Y AGE MARY)
(?X AGE TOM))
(transf '((- (+ ?x ?y) (+ ?z ?y))
(- ?x ?z))
'(- (+ (age tom) (age mary))
(+ (age bill) (age mary))))
=> (- (AGE TOM) (AGE BILL))
A pattern-pair can be extended by a test and computed variables:
(transf '( (sqrt (* ?n ?x)) (* ?ns (sqrt ?x))
(numberp ?n)
((?ns (sqrt ?n))) )
'(sqrt (* 2 z)))
=> (* 1.4142135 (SQRT Z))
Contents    Page-10    Prev    Next    Page+10    Index