|
18 | 18 | #+Lispworks
|
19 | 19 | (setq *PACKAGES-FOR-WARN-ON-REDEFINITION* nil)
|
20 | 20 |
|
21 |
| - #+LCL |
| 21 | + #+LCL |
22 | 22 | (compiler-options :warnings nil)
|
23 | 23 | #+sbcl
|
24 | 24 | (progn
|
|
36 | 36 | (defvar *paip-modules* '())
|
37 | 37 |
|
38 | 38 | (defvar *paip-files*
|
39 |
| - `("auxfns" "tutor" "examples" |
40 |
| - "intro" "simple" "overview" "gps1" "gps" "eliza1" "eliza" "patmatch" |
41 |
| - "eliza-pm" "search" "gps-srch" "student" "macsyma" "macsymar" "unify" |
42 |
| - "prolog1" "prolog" "prologc1" "prologc2" "prologc" "prologcp" |
43 |
| - "clos" "krep1" "krep2" "krep" "cmacsyma" "mycin" "mycin-r" "waltz" |
44 |
| - "othello" "othello2" "syntax1" "syntax2" "syntax3" "unifgram" |
45 |
| - "grammar" "lexicon" "interp1" "interp2" "interp3" |
| 39 | + `("auxfns" "tutor" "examples" |
| 40 | + "intro" "simple" "overview" "gps1" "gps" "eliza1" "eliza" "patmatch" |
| 41 | + "eliza-pm" "search" "gps-srch" "student" "macsyma" "macsymar" "unify" |
| 42 | + "prolog1" "prolog" "prologc1" "prologc2" "prologc" "prologcp" |
| 43 | + "clos" "krep1" "krep2" "krep" "cmacsyma" "mycin" "mycin-r" "waltz" |
| 44 | + "othello" "othello2" "syntax1" "syntax2" "syntax3" "unifgram" |
| 45 | + "grammar" "lexicon" "interp1" "interp2" "interp3" |
46 | 46 | "compile1" "compile2" "compile3" "compopt"))
|
47 | 47 |
|
48 | 48 | (defun requires (&rest files)
|
|
62 | 62 | "The location of the source files for this book. If things don't work,
|
63 | 63 | change it to reflect the location of the files on your computer.")
|
64 | 64 |
|
65 |
| -(defparameter *paip-source* |
| 65 | +(defparameter *paip-source* |
66 | 66 | (make-pathname :name nil :type "lisp" ;;??? Maybe Change this
|
67 |
| - :defaults *paip-directory*)) |
| 67 | + :defaults *paip-directory*)) |
68 | 68 |
|
69 | 69 | (defparameter *paip-binary*
|
70 | 70 | (make-pathname
|
|
81 | 81 | :defaults *paip-directory*))
|
82 | 82 |
|
83 | 83 | (defun paip-pathname (name &optional (type :lisp))
|
84 |
| - (make-pathname :name name |
| 84 | + (make-pathname :name name |
85 | 85 | :defaults (ecase type
|
86 | 86 | ((:lisp :source) *paip-source*)
|
87 | 87 | ((:binary :bin) *paip-binary*))))
|
|
169 | 169 | "Find all those elements of sequence that match item,
|
170 | 170 | according to the keywords. Doesn't alter sequence."
|
171 | 171 | (if test-not
|
172 |
| - (apply #'remove item sequence |
| 172 | + (apply #'remove item sequence |
173 | 173 | :test-not (complement test-not) keyword-args)
|
174 | 174 | (apply #'remove item sequence
|
175 | 175 | :test (complement test) keyword-args)))
|
|
208 | 208 | new-length, if that is longer than the current length."
|
209 | 209 | (if (and (arrayp array)
|
210 | 210 | (array-has-fill-pointer-p array))
|
211 |
| - (setf (fill-pointer array) |
| 211 | + (setf (fill-pointer array) |
212 | 212 | (max (fill-pointer array) new-length))))
|
213 | 213 |
|
214 | 214 | ;;; ==============================
|
215 | 215 |
|
216 | 216 | ;;; NOTE: In ANSI Common Lisp, the effects of adding a definition (or most
|
217 | 217 | ;;; anything else) to a symbol in the common-lisp package is undefined.
|
218 |
| -;;; Therefore, it would be best to rename the function SYMBOL to something |
219 |
| -;;; else. This has not been done (for compatibility with the book). |
| 218 | +;;; Therefore, it would be best to rename the function SYMBOL to something |
| 219 | +;;; else. This has not been done (for compatibility with the book). |
220 | 220 |
|
221 | 221 | (defun symbol (&rest args)
|
222 | 222 | "Concatenate symbols or strings to form an interned symbol"
|
|
237 | 237 | Like mapcon, but uses append instead of nconc."
|
238 | 238 | (apply #'append (mapcar fn list)))
|
239 | 239 |
|
240 |
| -(defun mklist (x) |
| 240 | +(defun mklist (x) |
241 | 241 | "If x is a list return it, otherwise return the list of x"
|
242 | 242 | (if (listp x) x (list x)))
|
243 | 243 |
|
244 | 244 | (defun flatten (exp)
|
245 | 245 | "Get rid of imbedded lists (to one level only)."
|
246 | 246 | (mappend #'mklist exp))
|
247 | 247 |
|
248 |
| -(defun random-elt (seq) |
| 248 | +(defun random-elt (seq) |
249 | 249 | "Pick a random element out of a sequence."
|
250 | 250 | (elt seq (random (length seq))))
|
251 | 251 |
|
|
405 | 405 | "Place a no-longer-needed element back in the pool."
|
406 | 406 | (vector-push-extend ,name ,resource))
|
407 | 407 | ,(if (> initial-copies 0)
|
408 |
| - `(mapc #',deallocate (loop repeat ,initial-copies |
| 408 | + `(mapc #',deallocate (loop repeat ,initial-copies |
409 | 409 | collect (,allocate))))
|
410 | 410 | ',name)))
|
411 | 411 |
|
|
456 | 456 |
|
457 | 457 | ;;;; Other:
|
458 | 458 |
|
459 |
| -(defun sort* (seq pred &key key) |
| 459 | +(defun sort* (seq pred &key key) |
460 | 460 | "Sort without altering the sequence"
|
461 | 461 | (sort (copy-seq seq) pred :key key))
|
462 | 462 |
|
|
468 | 468 |
|
469 | 469 | ;;; ==============================
|
470 | 470 |
|
471 |
| -(defun length=1 (x) |
| 471 | +(defun length=1 (x) |
472 | 472 | "Is x a list of length 1?"
|
473 | 473 | (and (consp x) (null (cdr x))))
|
474 | 474 |
|
|
561 | 561 | (do-result (i)
|
562 | 562 | (if (and (vectorp result-sequence)
|
563 | 563 | (array-has-fill-pointer-p result-sequence))
|
564 |
| - (setf (fill-pointer result-sequence) |
| 564 | + (setf (fill-pointer result-sequence) |
565 | 565 | (max i (fill-pointer result-sequence))))))
|
566 | 566 | (declare (inline do-one-call))
|
567 | 567 | ;; Decide if the result is a list or vector,
|
|
0 commit comments