# Artificial Intelligence Programming for the Macintosh — source transcripts, page 1

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-artificial-intelligence-programming-on-the-macintosh-1986-d284ff/1)

## Transcribed source material

Machine transcriptions and image descriptions; uncertain copy may be marked [illegible]. Verify against the linked originals. Historical rights remain with the original owners.

These are transcribed excerpts, not the full publications. Open the originals for remaining pages.

### Image 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-artificial-intelligence-programming-on-the-macintosh-1986-d284ff/1#scan-1c3c808b6a9705bc0c4e161c7a8dee413d84545b74e0c7a86429b816516ed189)

Artificial Intelligence Programming on the Macintosh

Transcribed text:

SAMS

The Waite Group

Artificial Intelligence
Programming on
the Macintosh

Dan Shafer

22447

Image description: A dark navy book cover with a framed illustration of a chrome robotic hand with red and blue highlights reaching toward a grid of dark hexagonal keys against a starry blue and red nebula background.

Reading notes: The small number 22447 in the upper right corner is a catalog or stock number and may not be part of the title block; it is transcribed as printed.

Languages: English

[Original Image 1](https://www.vintageapple.net/files/2fe181f2e3e71cb6e17e7eaa3fa085226fcaa37fa3ae904fab2da7d8d590450d/c20ae28eff7b9369009d073d.webp)

### PDF page 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-artificial-intelligence-programming-on-the-macintosh-1986-d284ff/1#scan-890a58c531fdb075008dcf1f31399b2d5dcd932f1b52c05be5596043da127696)

Artificial Intelligence Programming on the Macintosh

Transcribed text:

SAMS
22447
The Waite Group
Artificial Intelligence
Programming on
the Macintosh
Dan Shafer

Image description: A book cover with a dark navy background, a metallic robotic hand reaching toward a row of dark keyboard keys against a blue and red nebula with stars, framed by a purple border.

Reading notes: The stylized 'SAMS' logo and the script 'The Waite Group' are rendered in stylized typefaces and were transcribed as best read; the logo may be read as SAMS.

Languages: English

[Original PDF page 1](https://www.vintageapple.net/files/b0ab3590582dce57cdfb0508f97b70900b0e095021394f9a536d4bf671491ae0/Artificial_Intelligence_Programming_on_the_Macintosh_1986.pdf#page=1)

### PDF page 2

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-artificial-intelligence-programming-on-the-macintosh-1986-d284ff/1#scan-97f33f7929138c98cada7bfb05aacefa097839f861dbfc0732ed783ad3e12164)

Image description: The image is a entirely blank white page with no visible artwork, layout, or text.

Reading notes: No visible text or graphics found on the page; returned empty fields accordingly.

[Original PDF page 2](https://www.vintageapple.net/files/b0ab3590582dce57cdfb0508f97b70900b0e095021394f9a536d4bf671491ae0/Artificial_Intelligence_Programming_on_the_Macintosh_1986.pdf#page=2)

### PDF page 3

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-artificial-intelligence-programming-on-the-macintosh-1986-d284ff/1#scan-385bcf1dc2d30baa49fa87e4f65affdfbcc161331c87a1dcebe692c14ca2503e)

Artificial Intelligence Programming for the Macintosh®

Transcribed text:

Artificial   Intelligence
Programming for
the Macintosh®
Dan Shafer
Howard W. Sams &   Co.
A Division of   Macmillan,   Inc.
4300   West 62nd   Street,   Indianapolis,   IN   46268   USA

Printed product names: Macintosh®

Languages: English

[Original PDF page 3](https://www.vintageapple.net/files/b0ab3590582dce57cdfb0508f97b70900b0e095021394f9a536d4bf671491ae0/Artificial_Intelligence_Programming_on_the_Macintosh_1986.pdf#page=3)

### PDF page 4

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-artificial-intelligence-programming-on-the-macintosh-1986-d284ff/1#scan-d6a56bf1ca65c3acca859a9786914ece4c664b5ecbdcca33cb6ade85b77e26a3)

Transcribed text:

01986   by The Waite Group,   Inc.
FIRST   EDITION
FIRST   PRINTING-1986
All   rights reserved. No part of this book   shall   be reproduced, stored in a retrieval
system, or transmitted by any means, electronic, mechanical, photocopying,
recording, or otherwise, without written permission from the publisher. No patent
liability is assumed with respect to the use of the information contained herein.
While every precaution has been taken in the preparation of this book, the publisher
assumes no responsibility for errors or omissions. Neither is any liability assumed for
damages resulting from the use of the information contained herein.
International Standard Book Number: 0-672-22447-X
Library of Congress Catalog Card Number:   86-60027
Edited by:   Don Maclaren
Designed by:   T. R. Emrick
Cover Art by:   Ron Troxe/I
Computer Art by:   Don Clemons
Chapter   Opening   Cartoons by:   Bob Johnson
Printed   in the United States   of   America
Macintosh is a registered trademark of Apple Computer Co.
Experlogo is a registered trademark of ExperTelligence Co.
Microsoft Logo is a registered trademark of Microsoft Corp.

Reading notes: Cover art credit reads 'Ron Troxe/I', possibly a typo Library of Congress number 86-60027 may be a catalog number rather than a date

Printed product names: Macintosh · Experlogo

Printed dates: 1986 · 86-60027

Languages: English

[Original PDF page 4](https://www.vintageapple.net/files/b0ab3590582dce57cdfb0508f97b70900b0e095021394f9a536d4bf671491ae0/Artificial_Intelligence_Programming_on_the_Macintosh_1986.pdf#page=4)

### PDF page 5

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-artificial-intelligence-programming-on-the-macintosh-1986-d284ff/1#scan-7c3722a894f8a53fe15a08968ef4f90e567f24660d92ddfc93d73c9a7c82708a)

Transcribed text:

Contents
Preface   vii
PART   I   ARTIFICIAL INTELLIGENCE   PROGRAMMING
TECHNIQUES   1
Chapter 1   Overview:   What Makes a Program   Intelligent?   3
What Has This to Do with Programs?   5
Major Al Research Themes   5
Language   Issues   in Al   13
Conclusion   13
Chapter 2   Classic   Missionary-Cannibal   Problem   15
Refining the Problem   76
Applying the   Ideas   to the Missionary-Cannibal Problem   21
Using Search Techniques   26
The Missionary-Cannibal Program   28
Exploring Al with Missionaries and Cannibals   31
Summary: What We've Learned about Al Programming   33
Chapter 3 Micro-Logician   39
What   You'll   Learn   40
The Program   40
How Micro-Logician Works   43
Exploring Al with Micro-Logician   49
Summary: What We've Learned about Al Programming   50
Chapter 4   The   Digital   Poet   55
Two Types of Text Generation in Al   56
The Program   59
A Few Words about Poetry   62
How the Program Works   64
Exploring Al with Poetry Maker   73
Summary: What We've Learned about Al Programming   76
iii

Reading notes: Chapter 2 page reference for 'Refining the Problem' reads '76' and may be an OCR error for a different page number

Languages: English

[Original PDF page 5](https://www.vintageapple.net/files/b0ab3590582dce57cdfb0508f97b70900b0e095021394f9a536d4bf671491ae0/Artificial_Intelligence_Programming_on_the_Macintosh_1986.pdf#page=5)

### PDF page 6

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-artificial-intelligence-programming-on-the-macintosh-1986-d284ff/1#scan-db41dac169a44b623e6fb02d94db61ef4702bd01b9d79d652537ec5d7198fa12)

Transcribed text:

iv   I   Al Programming on   the   Macintosh
Chapter 5 Micro   Blocks   World   83
Parsing   Natural Language   84
The Role of Grammars   88
The   Program   91
Exploring Al with Micro Blocks World   102
Summary: What We've Learned about Al   703
Chapter 6   Intelligent   Maze Game   111
Pattern-Matching in Al   112
When Prediction   Is   Less Certain   115
Three Types of Pattern-Matching   116
The   Intelligent   Maze   Program   117
How   It   Works   119
PLAY Procedure Group   119
Exploring Al with the   Intelligent   Maze Program   122
Summary: What We've Learned about Al   122
PART   II   ARTIFICIAL   INTELLIGENCE   DATA BASES   129
Chapter 7 A   Prolog   Interpreter   131
Why Prolog or Prologo?   132
The Program's Background   132
Prolog and Expert Systems   132
What   Is   Prolog?   133
Prologo: An Overview   136
The Program   143
Exploring Al with Prologo   148
Summary   150
Chapter 8 Two   Prologo   Knowledge   Bases   757
Knowledge Acquisition: The Key Roadblock?   158
Constructing Knowledge Bases: General Principles   762
Querying Knowledge Bases   766
The Literary Knowledge Base   167
The Geography Knowledge Base   173
Exploring Al Further with Prologo   177
What We've Learned about Al   7 78
PART   Ill   ARTIFICIAL   INTELLIGENCE   LANGUAGES   179
Chapter 9   Does the Language Make a   Difference?   181
Where's the Super Language?   782
What Programming Languages Do...and Don't Do   182
What an Al Language Needs   183
Popular Languages and Al   185
Summary and Looking Ahead   786
Chapter   10   A Quick Logo Refresher   789
Logo's   Image   190

Reading notes: Table of contents page numbers contain OCR errors (e.g., '703', '757', '7 78', 'Ill' for 'III') Chapter 9 heading is printed in a different font size and its page numbers are uncertain

Languages: English

[Original PDF page 6](https://www.vintageapple.net/files/b0ab3590582dce57cdfb0508f97b70900b0e095021394f9a536d4bf671491ae0/Artificial_Intelligence_Programming_on_the_Macintosh_1986.pdf#page=6)

### PDF page 7

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-artificial-intelligence-programming-on-the-macintosh-1986-d284ff/1#scan-16186313511348842103982d54ab41f0c0628b6c14b796169973048c6b47ecd8)

Transcribed text:

Anatomy of a Logo Program   190
The Language of Logo   193
Graphics Commands   193
Macintosh® QuickDraw Graphics Commands   797
Input/Output   Commands   797
Conditionals   and Program   Flow   Control   799
Math Functions   202
List-Processing Commands   204
Arrays   208
Predicate Commands: Testing   209
Property Lists   209
Workspace Management   211
Chapter 11   A   LISP   Refresher   213
Introduction to   LISP   274
Basic   LISP   Syntax   214
Data Structures in   LISP   275
Program Structure in   LISP   276
Operations on Lists   218
Defining Functions   221
Setting   Up   Variables   227
Conditional   Processing   222
Essential   Input/Output   225
Math Operators and Functions   228
LISP:   Rich and   Extensible   230
Chapter 12   A Brief   Prolog   Tutorial   233
Introduction and Purpose   234
Describing Data   Relationships   236
Queries   239
Arithmetic Processing in   Prolog   243
Creating   Rules   with   Conditional   Sentences   245
List-Processing   Fundamentals   247
Input/Output   Primitives   250
Concluding   Remarks   252
Chapter 13   For   BASIC   Programmers   255
Fundamental   Differences   256
Specific   Implementation   Concerns   257
Property Lists   260
Other   Considerations   262
Appendix A   LISP   Listings of   Selected   Programs   265
Appendix B Converting Between Mac Logos   277
Appendix C   Suggestions for Further Reading   279
Index   285
Contents   Iv

Reading notes: Source is a table of contents, not advertising copy; headline and product fields are limited accordingly. Some entries contain irregular spacing and OCR-like line breaks that may affect exact spelling.

Printed product names: Macintosh® QuickDraw Graphics Commands

Languages: English

[Original PDF page 7](https://www.vintageapple.net/files/b0ab3590582dce57cdfb0508f97b70900b0e095021394f9a536d4bf671491ae0/Artificial_Intelligence_Programming_on_the_Macintosh_1986.pdf#page=7)

### PDF page 8

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-artificial-intelligence-programming-on-the-macintosh-1986-d284ff/1#scan-a68c3f1c169d7bce77b21b244576cb94c25244258f91595e3d7da553979751e1)

Transcribed text:

Preface
Artificial   Intelligence   (Al) has fascinated me from the first time   I   heard about it.
My first exposure to it came on a tour of the Stanford   Artificial   Intelligence   Labo-
ratory   (SAIL).   I   was entranced at the work the   people   at   SAIL   were doing with
computer   music   generation,   robotics,   and   problem-solving.   This   book   is the
beginning of the   fulfillment   of my intense desire to be part of what is happening
in that community.
I   also   wanted this book to   fill   what seemed to me to be a rather   large   gap in
the   literature   of Al.   I   have searched   fruitlessly   for a book that did not assume the
reader was   already   knowledgeable   about programming in an esoteric   language
such as   LISP   and aware of such   fundamental   computer science ideas as heuris-
tics and search mechanisms.   I   hope this book takes a   small   step toward   filling
the need of interesting more and more   people   in the   field   of Al.
Few   would   argue with the proposition that Al   is the next frontier in the
world   of computers.   In   the past two years,   real   Al   development   tools   and   lan-
guages   have   become   available   on   microcomputers,   making   hands-on   experi-
mentation   with   and   exploration   of this fascinating   field   accessible   to   millions
who otherwise   would   have had to content   themselves   with reading about the
subject.
The growing importance of Al   is enough of a   practical   reason for you to
spend   your time   reading this   book, examining the   programs it contains,   and
exploring   Al with the book as a guide.   But the   value   of   learning   more about
intelligence-artificial   or natural-transcends even the practical benefit of learn-
ing about a field that promises to have a tremendous impact on our daily lives.
Who This Book   Is   For
On   one level, this is an introductory book about Al programming techniques. To
read the first part of each chapter in Part   I   and   all   of Part   II   requires no program-
ming background   in particular, though a nodding acquaintance with some of
the basic ideas of computers and programming would   be   useful.   On   another
level, the book abounds with examples and complete Al   programs written in
ExperLogo® from   ExperTelligence   of Santa Barbara, California. To make   full   use
of   these   programs,   you   should   have   some   Logo   programming   knowledge
(though Chapter   10   may give you enough of an introduction to the language),
access to an Apple Macintosh® computer, and a copy of ExperLogo®.
vii

Reading notes: Some words are split across line breaks with hyphens and extra spacing (e.g., 'Labo-ratory', 'intelli-gence'), which may affect exact spelling. Printed date is a relative phrase ('past two years') with no explicit year.

Printed product names: ExperLogo · Apple Macintosh

Printed dates: past two years

Languages: English

[Original PDF page 8](https://www.vintageapple.net/files/b0ab3590582dce57cdfb0508f97b70900b0e095021394f9a536d4bf671491ae0/Artificial_Intelligence_Programming_on_the_Macintosh_1986.pdf#page=8)

### PDF page 9

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-artificial-intelligence-programming-on-the-macintosh-1986-d284ff/1#scan-f9c94dbf20ffef1eddeb1be685ff42901defa7601d6c1e8adf5a098f58aea110)

Transcribed text:

viii   I   Al   Programming   on   the Macintosh
If   you use ExperLogo® on your Macintosh®,   you'll   also   find that an   external
drive is extremely   helpful   and a printer   almost   a requirement.
Two Decisions
Two   aspects of this   book deserve   an   explanation.   Why   did   I   focus   on   the
Macintosh® and why did i choose Logo as the   principal   language?
The Mac, with its desktop, icons, and windows, comes   closer   to what most
Al   researchers view as a "rich and supportive" programming environment than
any other machine on the market. As you program the examples in this book,
you   will   be doing so in an environment that is quite   similar   to that enjoyed by
professional   Al   workers.   In   addition, the Mac   is fun to   use and   seems more
accessible to those new to computers than any other computer.
Logo is an   excellent   compromise selection between   LISP,   which   is   clearly
the   Al   language of choice but is difficult to learn and not readily available on the
Mac, and   BASIC,   which is far more available but not   well   suited to   Al   program-
ming.   I   deal   with the issue of language selection at some length in   Part   II   of this
book.
Besides, Logo is easy to learn and is gaining increasing acceptance in the
educational community as a superb language for the exploration of new ideas.
And that is precisely what   I   wish for you: exploration of new ideas.
DAN SHAFER

Reading notes: Text is OCR-like with possible hyphenation or spacing artifacts, such as 'Al' for 'AI' and 'i' for 'I'.

Printed product names: ExperLogo · Macintosh

Languages: English

[Original PDF page 9](https://www.vintageapple.net/files/b0ab3590582dce57cdfb0508f97b70900b0e095021394f9a536d4bf671491ae0/Artificial_Intelligence_Programming_on_the_Macintosh_1986.pdf#page=9)

### PDF page 10

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-artificial-intelligence-programming-on-the-macintosh-1986-d284ff/1#scan-5a2915797ebd4a2ada370a03b8b53cf02731c4be41ff8752083da989a92fbf29)

Transcribed text:

Acknowledgements
As   I   was   developing   the ideas for this book,   I   was fortunate enough to find
myself   involved   with a   small   group of programmers and   Al   fans who   helped   me
to focus the content, the direction, and the approach of the book.   I   am   grateful
to these   people-Chuck   Blanchard,   John Worthington, Jason   Christofilos,   Mike
VanHorn, and my editor, Robert Lafore-for   helping   to brainstorm the book and
for   believing   in it.
Along   the way,   I   have had the chance to discuss the book and its contents
with some   truly   helpful,   even inspirational,   Al   workers. A   special   vote of thanks
goes to   Steve   Lurya   of   Santa   Barbara,   a former   ExperTelligence   programmer
who made a   particular   contribution to   Chapter   7   and   also   helped   me   grapple
with some of the ideas of   Al   and   Al   programming and thus   helped   improve the
book as a   whole.
ExperTelligence   personnel-notably,   President   Denison   Bollay,   Marketing
VP   Tony   Uhler,   and   programmer-engineer Robert   Reali-have   also   been   very
helpful   in   aiding   my   understanding   of   their   fine   products,   Experlogo   and
Experlisp.
As   usual,   my   editorial   associate and research aide Don Huntington made a
major contribution to this work.   I   am   grateful   to him for tightened sentences,
crystallized   thinking, and organizational   help.
My editor,   Robert   Lafore,   has been   a source of continuing support and
inspiration as this book has grown from a   collection   of Mac programs about   Al
into a cohesive introductory book on   Al   techniques and   languages.   In   brain-
storming sessions and in editing discussions, he has questioned, probed, prod-
ded, and   cajoled   me into making this book as good as   I   could   possibly   make it.
Ken Schieser is a   remarkable   young man with an   excellent   grasp of Logo
who wrote two of the more intriguing programs   in this   book:   "Micro   Blocks
World"   and the   "Intelligent   Maze."   He   is the first person   I've   met who   is as
good as he is at programming yet doesn't want to make it a career.
Finally,   my   family   has continued, as they have with   all   of my previous writ-
ing efforts, to   be supportive and   patient with   me.   I   appreciate their   love   and
closeness-even   when that   closeness   is to the back of my head or through a
closed   office door-more than words can express.
ix

Reading notes: Source text contains hyphenated line breaks and irregular spacing, such as 'Al' which likely represents 'AI'.

Printed product names: Experlogo · Experlisp

Languages: English

[Original PDF page 10](https://www.vintageapple.net/files/b0ab3590582dce57cdfb0508f97b70900b0e095021394f9a536d4bf671491ae0/Artificial_Intelligence_Programming_on_the_Macintosh_1986.pdf#page=10)

### PDF page 11

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-artificial-intelligence-programming-on-the-macintosh-1986-d284ff/1#scan-2b6abb592f932c683757e661e95fc7a97d5bb49ee9f610ee64dc5a2be0ce2880)

Transcribed text:

This book is dedicated to Albert and Mary Lee Hunton.   Your   natural
common   sense and wisdom about how the world and people work
far exceed any intelligence-real   or   artifical-1 know about.
God bless you both.
xi

Reading notes: The word "artifical" is a likely typo in the source copy and is preserved as printed. Line breaks within sentences appear to be from extraction, so reading order may differ slightly from the original layout.

Languages: English

[Original PDF page 11](https://www.vintageapple.net/files/b0ab3590582dce57cdfb0508f97b70900b0e095021394f9a536d4bf671491ae0/Artificial_Intelligence_Programming_on_the_Macintosh_1986.pdf#page=11)

[Next transcribed scans](https://www.vintageapple.net/transcripts/media/va-artificial-intelligence-programming-on-the-macintosh-1986-d284ff/2.md)
