Skip to content

Commit 066aa46

Browse files
committed
lisp code: remove trailing whitespace
1 parent 22fb8ca commit 066aa46

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+305
-305
lines changed

lisp/auxfns.lisp

+21-21
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#+Lispworks
1919
(setq *PACKAGES-FOR-WARN-ON-REDEFINITION* nil)
2020

21-
#+LCL
21+
#+LCL
2222
(compiler-options :warnings nil)
2323
#+sbcl
2424
(progn
@@ -36,13 +36,13 @@
3636
(defvar *paip-modules* '())
3737

3838
(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"
4646
"compile1" "compile2" "compile3" "compopt"))
4747

4848
(defun requires (&rest files)
@@ -62,9 +62,9 @@
6262
"The location of the source files for this book. If things don't work,
6363
change it to reflect the location of the files on your computer.")
6464

65-
(defparameter *paip-source*
65+
(defparameter *paip-source*
6666
(make-pathname :name nil :type "lisp" ;;??? Maybe Change this
67-
:defaults *paip-directory*))
67+
:defaults *paip-directory*))
6868

6969
(defparameter *paip-binary*
7070
(make-pathname
@@ -81,7 +81,7 @@
8181
:defaults *paip-directory*))
8282

8383
(defun paip-pathname (name &optional (type :lisp))
84-
(make-pathname :name name
84+
(make-pathname :name name
8585
:defaults (ecase type
8686
((:lisp :source) *paip-source*)
8787
((:binary :bin) *paip-binary*))))
@@ -169,7 +169,7 @@
169169
"Find all those elements of sequence that match item,
170170
according to the keywords. Doesn't alter sequence."
171171
(if test-not
172-
(apply #'remove item sequence
172+
(apply #'remove item sequence
173173
:test-not (complement test-not) keyword-args)
174174
(apply #'remove item sequence
175175
:test (complement test) keyword-args)))
@@ -208,15 +208,15 @@
208208
new-length, if that is longer than the current length."
209209
(if (and (arrayp array)
210210
(array-has-fill-pointer-p array))
211-
(setf (fill-pointer array)
211+
(setf (fill-pointer array)
212212
(max (fill-pointer array) new-length))))
213213

214214
;;; ==============================
215215

216216
;;; NOTE: In ANSI Common Lisp, the effects of adding a definition (or most
217217
;;; 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).
220220

221221
(defun symbol (&rest args)
222222
"Concatenate symbols or strings to form an interned symbol"
@@ -237,15 +237,15 @@
237237
Like mapcon, but uses append instead of nconc."
238238
(apply #'append (mapcar fn list)))
239239

240-
(defun mklist (x)
240+
(defun mklist (x)
241241
"If x is a list return it, otherwise return the list of x"
242242
(if (listp x) x (list x)))
243243

244244
(defun flatten (exp)
245245
"Get rid of imbedded lists (to one level only)."
246246
(mappend #'mklist exp))
247247

248-
(defun random-elt (seq)
248+
(defun random-elt (seq)
249249
"Pick a random element out of a sequence."
250250
(elt seq (random (length seq))))
251251

@@ -405,7 +405,7 @@
405405
"Place a no-longer-needed element back in the pool."
406406
(vector-push-extend ,name ,resource))
407407
,(if (> initial-copies 0)
408-
`(mapc #',deallocate (loop repeat ,initial-copies
408+
`(mapc #',deallocate (loop repeat ,initial-copies
409409
collect (,allocate))))
410410
',name)))
411411

@@ -456,7 +456,7 @@
456456

457457
;;;; Other:
458458

459-
(defun sort* (seq pred &key key)
459+
(defun sort* (seq pred &key key)
460460
"Sort without altering the sequence"
461461
(sort (copy-seq seq) pred :key key))
462462

@@ -468,7 +468,7 @@
468468

469469
;;; ==============================
470470

471-
(defun length=1 (x)
471+
(defun length=1 (x)
472472
"Is x a list of length 1?"
473473
(and (consp x) (null (cdr x))))
474474

@@ -561,7 +561,7 @@
561561
(do-result (i)
562562
(if (and (vectorp result-sequence)
563563
(array-has-fill-pointer-p result-sequence))
564-
(setf (fill-pointer result-sequence)
564+
(setf (fill-pointer result-sequence)
565565
(max i (fill-pointer result-sequence))))))
566566
(declare (inline do-one-call))
567567
;; Decide if the result is a list or vector,

lisp/clos.lisp

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
;;;; File clos.lisp: Object-oriented programming examples
66

7-
(defstruct account
7+
(defstruct account
88
(name "") (balance 0.00) (interest-rate .06))
99

1010
(defun account-withdraw (account amt)
@@ -85,7 +85,7 @@
8585

8686
(defun generic-fn-p (fn-name)
8787
"Is this a generic function?"
88-
(and (fboundp fn-name)
88+
(and (fboundp fn-name)
8989
(eq (get fn-name 'generic-fn) (symbol-function fn-name))))
9090

9191
;;; ==============================

lisp/cmacsyma.lisp

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
(deftype polynomial () 'simple-vector)
2828

29-
(defsetf main-var (p) (val)
29+
(defsetf main-var (p) (val)
3030
`(setf (svref (the polynomial ,p) 0) ,val))
3131

3232
(defsetf coef (p i) (val)
@@ -37,7 +37,7 @@
3737
(defun degree (p) (- (length (the polynomial p)) 2))
3838

3939
(defun poly (x &rest coefs)
40-
"Make a polynomial with main variable x
40+
"Make a polynomial with main variable x
4141
and coefficients in increasing order."
4242
(apply #'vector x coefs))
4343

@@ -58,7 +58,7 @@
5858
(mapcar #'prefix->canon (exp-args x))))
5959
(t (error "Not a polynomial: ~a" x))))
6060

61-
(dolist (item '((+ poly+) (- poly-) (* poly*poly)
61+
(dolist (item '((+ poly+) (- poly-) (* poly*poly)
6262
(^ poly^n) (D deriv-poly)))
6363
(setf (get (first item) 'prefix->canon) (second item)))
6464

lisp/compile1.lisp

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"Compile a lambda form into a closure with compiled code."
5555
(assert (and (listp args) (every #'symbolp args)) ()
5656
"Lambda arglist must be a list of symbols, not ~a" args)
57-
;; For now, no &rest parameters.
57+
;; For now, no &rest parameters.
5858
;; The next version will support Scheme's version of &rest
5959
(make-fn
6060
:env env :args args
@@ -112,7 +112,7 @@
112112
(if (atom name)
113113
`(name! (set! ,name . ,body) ',name)
114114
(scheme-macro-expand
115-
`(define ,(first name)
115+
`(define ,(first name)
116116
(lambda ,(rest name) . ,body)))))
117117

118118
(defun name! (fn name)
@@ -130,7 +130,7 @@
130130

131131
(defun show-fn (fn &optional (stream *standard-output*) (depth 0))
132132
"Print all the instructions in a function.
133-
If the argument is not a function, just princ it,
133+
If the argument is not a function, just princ it,
134134
but in a column at least 8 spaces wide."
135135
(if (not (fn-p fn))
136136
(format stream "~8a" fn)

lisp/compile2.lisp

+5-5
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"Report an error if form has wrong number of args."
4141
(let ((n-args (length (rest form))))
4242
(assert (<= min n-args max) (form)
43-
"Wrong number of arguments for ~a in ~a:
43+
"Wrong number of arguments for ~a in ~a:
4444
~d supplied, ~d~@[ to ~d~] expected"
4545
(first form) form n-args min (if (/= min max) max))))
4646

@@ -97,7 +97,7 @@
9797
(let ((L2 (gen-label)))
9898
(seq pcode (gen 'TJUMP L2) ecode (list L2)
9999
(unless more? (gen 'RETURN)))))
100-
((null ecode) ; (if p x) ==> p (FJUMP L1) x L1:
100+
((null ecode) ; (if p x) ==> p (FJUMP L1) x L1:
101101
(let ((L1 (gen-label)))
102102
(seq pcode (gen 'FJUMP L1) tcode (list L1)
103103
(unless more? (gen 'RETURN)))))
@@ -143,7 +143,7 @@
143143

144144
;;; ==============================
145145

146-
(defstruct (prim (:type list))
146+
(defstruct (prim (:type list))
147147
symbol n-args opcode always side-effects)
148148

149149
;;; Note change from book: some of the following primitive fns have had
@@ -157,10 +157,10 @@
157157
(/= 2 /= nil nil) (= 2 = nil nil)
158158
(eq? 2 eq nil nil) (equal? 2 equal nil nil) (eqv? 2 eql nil nil)
159159
(not 1 not nil nil) (null? 1 not nil nil) (cons 2 cons true nil)
160-
(car 1 car nil nil) (cdr 1 cdr nil nil) (cadr 1 cadr nil nil)
160+
(car 1 car nil nil) (cdr 1 cdr nil nil) (cadr 1 cadr nil nil)
161161
(list 1 list1 true nil) (list 2 list2 true nil) (list 3 list3 true nil)
162162
(read 0 read nil t) (write 1 write nil t) (display 1 display nil t)
163-
(newline 0 newline nil t) (compiler 1 compiler t nil)
163+
(newline 0 newline nil t) (compiler 1 compiler t nil)
164164
(name! 2 name! true t) (random 1 random true nil)))
165165

166166
(defun primitive-p (f env n-args)

0 commit comments

Comments
 (0)