-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpart-II-packages.lisp
222 lines (198 loc) · 5.81 KB
/
part-II-packages.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*-
;;;; Copyright (c) 2014, 2015 Zlatozar Zhelyazkov
;;;; part-II-packages.lisp: PART II "Early AI Programs"
(in-package :cl-user)
;;; ____________________________________________________________________________
(defpackage #:ch4-first
(:documentation "Chapter 4. GPS: The General Problem Solver (first version)")
(:use #:common-lisp
#:inspect
#:tutor)
(:import-from :paip-aux
#:find-all))
(defpackage #:ch4-final
(:documentation "Chapter 4. GPS: The General Problem Solver (final version)")
(:use #:common-lisp
#:inspect
#:tutor)
(:import-from :paip-aux
#:mappend
#:find-all
#:find-all-if
#:undebug
#:dbg-indent)
(:shadowing-import-from :paip-aux
#:debug)
;; Utilities (needed for Chapter 6)
(:export #:op-action
#:op-preconds
#:op-add-list
#:op-del-list
#:*ops*
#:use
#:action-p
#:make-block-ops
#:move-op
#:move-ons)
;; Final version of GPS
(:export #:gps
#:make-op
#:find-path))
(defpackage #:ch4-exercises
(:documentation "Selected exercises form Chapter 4")
(:use #:common-lisp
#:pcl-test)
(:export #:permutations
#:test-permutations))
;;; ____________________________________________________________________________
(defpackage #:pat-base
(:documentation "Simple version of 'pat-match' and common functions.
In Chapters 5 and 6 'pat-match' will be improved.")
(:use #:common-lisp)
(:export #:fail
#:no-bindings
#:variable-p
#:get-binding
#:binding-val
#:binding-var
#:make-binding
#:lookup
#:match-variable
#:extend-bindings))
(defpackage #:ch5-first
(:documentation "Chapter 5. ELIZA: Dialog with a Machine (first version)")
(:use #:common-lisp
#:inspect
#:tutor
#:pat-base)
(:import-from :paip-aux
#:flatten
#:starts-with
#:random-elt)
(:export #:rule-pattern
#:rule-responses
#:switch-viewpoint))
(defpackage #:ch5-final
(:documentation "Chapter 5. ELIZA: Dialog with a Machine (final version)")
(:use #:common-lisp
#:inspect
#:tutor
#:pat-base
#:ch5-first)
(:import-from :paip-aux
#:starts-with
#:random-elt
#:flatten
#:mklist)
(:export #:read-line-no-punct
#:punctuation-p
#:print-with-spaces
#:eliza))
(defpackage #:ch5-exercises
(:documentation "Selected exercises form Chapter 5")
(:use #:common-lisp
#:pcl-test)
(:export #:mappend
#:test-mappend))
;;; ____________________________________________________________________________
(defpackage #:ch6
(:documentation "Chapter 6. Building Software Tools")
(:use #:common-lisp
#:inspect
#:tutor
#:pat-base)
(:import-from :paip-aux
#:dbg
#:find-all-if
#:undebug
#:declare-ignore
#:flatten
#:random-elt)
(:shadowing-import-from :paip-aux
#:debug)
(:import-from :ch4-final
#:op-action
#:op-preconds
#:op-add-list
#:op-del-list
#:*ops*
#:use
#:action-p
#:make-block-ops
#:move-op
#:move-ons)
(:import-from :ch5-first
#:switch-viewpoint)
(:export #:pat-match
#:binary-tree
#:finite-binary-tree
#:prompt-generator
#:prepend
#:diff
#:is
#:deg->radians
#:sorter
#:distance
#:tree-search
#:depth-first-search
#:breadth-first-search
#:finite-binary-tree
#:best-first-search
#:beam-search
#:iter-wide-search
#:graph-search
#:a*-search
#:search-all
#:rule-based-translator
#:pat-match-abbrev
#:expand-pat-match-abbrev
;; needed only for `ch13' examples
#:city
#:neighbors))
(defpackage #:ch6-exercises
(:documentation "Selected exercises form Chapter 6")
(:use #:common-lisp
#:pcl-test
#:ch6)
(:export #:compose
#:search-n
#:test-depth-first-search))
;;; ____________________________________________________________________________
(defpackage #:ch7
(:documentation "Chapter 7. STUDENT: Solving Algebra Word Problems")
(:use #:common-lisp
#:inspect
#:tutor)
(:shadow #:exp)
(:import-from :pat-base
#:binding-val
#:binding-var)
(:import-from :ch6
#:pat-match
#:rule-based-translator
#:pat-match-abbrev
#:expand-pat-match-abbrev))
(defpackage #:ch7-exercises
(:documentation "Selected exercises form Chapter 7")
(:use #:common-lisp
#:pcl-test
#:ch7))
;;; ____________________________________________________________________________
(defpackage #:ch8
(:documentation "Chapter 8. Symbolic Mathematics: A Simplification Program")
(:use #:common-lisp
#:inspect
#:tutor)
(:shadow #:exp)
(:import-from :paip-aux
#:starts-with
#:length=1)
(:export #:infix->prefix
#:prefix->infix
#:simplify
#:simp))
(defpackage #:ch8-exercises
(:documentation "Selected exercises form Chapter 8")
(:use #:common-lisp
#:pcl-test
#:ch8))