没有合适的资源?快使用搜索试试~ 我知道了~
首页Paradigms of Artificial Intelligence Programming Case Studies in Common Lisp
Paradigms of Artificial Intelligence Programming Case Studies in...
需积分: 12 107 浏览量
更新于2023-05-26
评论 1
收藏 55.12MB PDF 举报
作者: Peter Norvig 出版社: Morgan Kaufmann 副标题: Case Studies in Common Lisp
资源详情
资源评论
资源推荐




All too often, the teaching of computer programming consists of explaining the
syntax of the chosen language, showing the student a 10
-
line program, and then
asking the student to write programs. In this book, we take the approach that the
best way to learn to write is to read (and conversely, a good way to improve reading
skills is to write). After the briefest of introductions to Lisp, we start right off with
complex programs and ask the reader to understand and make small modifications
to these programs.
The premise of this book is that you can only write something useful and inter
-
esting when you both understand what makes good writing and have something
interesting to say. This holds for writing programs as well as for writing prose. As
Kernighan and Plauger put it on the cover of Software Tools in Pascal:
Good programming is not learned from generalities, but by seeing how signif
-
icant programs can be made clean, easy to read, easy to maintain and modify,
human
-
engineered, efficient, and reliable,
by
the application of common sense
and good
programmingpractices. Careful study and imitation
of
good programs
leads to better writing.
The proud craftsman is often tempted to display only the finished work, without
any indication of the false starts and mistakes that are anunfortunate but unavoidable
part of the creative process. Unfortunately, this reluctance to unveil the process is
a barrier to learning; a student of mathematics who sees a beautiful 10
-
line proof in
a textbook can marvel at its conciseness but does not learn how to construct such a
proof. This book attempts to show the complete programming process,
"warts and
all.
"
Each chapter starts with a simple version of a program, one that works on some
examples but fails on others. Each chapter shows how these failures can be analyzed
to build increasingly sophisticated versions of the basic program. Thus, the reader
can not only appreciate the final result but also see how to learn from mistakes and
refine an initially incomplete design. Furthermore, the reader who finds a particular
chapter is becoming too difficult can skip to the next chapter, having gained some
appreciation of the problem area, and without being overwhelmed by the details.
This book presents a body of knowledge loosely known as
"A1 programming
techniques,
"
but it must be recognized that there are no clear
-
cut boundaries on this
body of knowledge. To be sure, no one can be a good
A1 programmer without first
being a good programmer. Thus, this book presents topics (especially in parts
I11
and
V)
that are not A1 per se, but are essential background for any A1 practitioner.
Why
Lisp?
Why
Common
Lisp?
Lisp is one
of
the oldest programming languages still in widespread use today. There
have been many versions of Lisp, each sharing basic features but differing in detail.
In this book we use the version called Common Lisp, which is the most widely
accepted standard. Lisp has been chosen for three reasons.

First, Lisp is the most popular language for A1 programming, particularly in the
United States. If you're going to learn a language, it might as well be one with a
growing literature, rather than a dead tongue.
Second, Lisp makes it easy to capture relevant generalizations in defining new
objects. In particular, Lisp makes it easy to define new languages especially targeted
to the problem at hand. This is especially handy in
A1 applications, which often
manipulate complex information that is most easily represented in some novel form.
Lisp is one of the few languages that allows full flexibility in defining and manipu
-
lating programs as well as data. All programming languages, by definition, provide
a means of defining programs, but many other languages limit the ways in which a
program can be used, or limit the range of programs that can be defined, or require
the programmer to explicitly state irrelevant details.
Third, Lisp makes it very easy to develop a working program fast. Lisp programs
are concise and are uncluttered by low
-
level detail. Common Lisp offers an unusually
large number of useful predefined objects, including over 700 functions. The pro
-
gramming environment (such as debugging tools, incremental compilers, integrated
editors, and interfaces to window systems) that surround Lisp systems are usually
very good. And the dynamic, interactive nature of Lisp makes it easy to experiment
and change a program while it is being developed.
It must be mentioned that in Europe and Japan,
Prolog has been as popular as
Lisp for
A1 work. Prolog shares most of Lisp's advantages in terms of flexibility and
conciseness. Recently, Lisp has gained popularity worldwide, and
Prolog is becom
-
ing more well known in the United States. As a result, the average A1 worker today is
likely to be bilingual. This book presents the key ideas behind
Prolog in chapters
11
and 12, and uses these ideas in subsequent chapters, particularly 20 and 21.
The dialect of Lisp known as Scheme is also gaining in popularity, but primarily
for teaching and experimenting with programming language design and techniques,
and not so much for writing large
A1 programs. Scheme is presented in chapters 22
and 23. Other dialects of Lisp such as Franz Lisp,
MacLisp, InterLisp, ZetaLisp,
and Standard Lisp are now considered obsolete. The only new dialect of Lisp to be
proposed recently is
EuLisp, the European Lisp. A few dialects of Lisp live on as
embedded extension languages. For example, the Gnu Emacs text editor uses elisp,
and the
AutoCad computer
-
aided design package uses AutoLisp, a derivative of Xlisp.
In the future, it is likely that Scheme will become a popular extension language, since
it is small but powerful and has an officially sanctioned standard definition.
There is a myth that Lisp (and
Prolog) are
"
special
-
purpose
"
languages, while
languages like Pascal and C are
"
general purpose.
"
Actually, just the reverse is
true. Pascal and C are special
-
purpose languages for manipulating the registers and
memory of a von Neumann
-
style computer. The majority of their syntax is devoted
to arithmetic and Boolean expressions, and while they provide some facilities for
forming data structures, they have poor mechanisms for procedural abstraction
or control abstraction. In addition, they are designed for the state
-
oriented style
剩余963页未读,继续阅读
















dmn0123
- 粉丝: 13
- 资源: 18
上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助

会员权益专享
安全验证
文档复制为VIP权益,开通VIP直接复制

评论0