CMU Artificial Intelligence Repository
Home INFO Search FAQs Repository Root

Select Match

The SELECT-MATCH macro is useful for implementing interpreters, (defun eval-expr (x) (select-match x ('add x y) => (+ x y) ('sub x y) => (- x y) ('mul x y) => (* x y) ('div x y) => (/ x y))) and also for programs in general, (defun my-append (a b) (select-match a 'nil => b (hd . tl) => (cons hd (my-append tl b)))) (defun fact (n) (select-match n '0 => 1 n => (* n (fact (1- n)))))

Copying: Copying, distribution, and modification permitted. CD-ROM: Prime Time Freeware for AI, Issue 1-1 Author(s): Stephen Adams Computer Science Southampton University Southampton SO9 5NH, UK Keywords: Authors!Adams, Lisp!Matchers, Matchers, Select Match References: ?
Last Web update on Mon Feb 13 10:30:11 1995