Chapter 6

Building Software Tools

Man is a tool-using animal…Without tools he is nothing with tools he is all.

–Thomas Carlyle (1795–1881)

In chapters 4 and 5 we were concerned with building two particular programs, GPS and ELIZA In this chapter, we will reexamine those two programs to discover some common patterns. Those patterns will be abstracted out to form reusable software tools that will prove helpful in subsequent chapters.

6.1 An Interactive Interpreter Tool

The structure of the function eliza is a common one. It is repeated below:

(defun eliza ()

 "Respond to user input using pattern matching rules."

 (loop

  (print 'eliza >)

  (print (flatten (use-eliza-rules (read))))))

Many other applications use this pattern, including Lisp itself. The top ...

Get Paradigms of Artificial Intelligence Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.