;;;; -*- Mode: Lisp; Syntax: Common-Lisp -*- ;;;; Code from Paradigms of AI Programming ;;;; Copyright (c) 1991 Peter Norvig ;;;; File eliza-pm.lisp: Updated version of eliza in section 6.3 (requires "patmatch" "eliza") (defun eliza () "Respond to user input using pattern matching rules." (loop (print 'eliza>) (print (flatten (use-eliza-rules (read)))))) (defun use-eliza-rules (input) "Find some rule with which to transform the input." (rule-based-translator input *eliza-rules* :action #'(lambda (bindings responses) (sublis (switch-viewpoint bindings) (random-elt responses)))))