From: Mark Wooding Date: Sat, 20 Dec 2014 22:18:25 +0000 (+0000) Subject: Whitespace cleanups across the board. X-Git-Url: https://git.distorted.org.uk/~mdw/lisp/commitdiff_plain/4da88bb98b75edf5033fa864cae0d3d1c397ac07 Whitespace cleanups across the board. --- diff --git a/aa-tree.lisp b/aa-tree.lisp index 3c60672..6c42746 100644 --- a/aa-tree.lisp +++ b/aa-tree.lisp @@ -307,12 +307,12 @@ (unless key (setf key (gensym "KEY")) (push key ignores)) (unless value (setf value (gensym "VALUE")) (push value ignores)) `(block nil - (mapaa (lambda (,key ,value) + (mapaa (lambda (,key ,value) ,@decls ,@(and ignores `((declare (ignore ,@ignores)))) (tagbody ,@body)) - ,tree) - ,result)))) + ,tree) + ,result)))) ;;;-------------------------------------------------------------------------- ;;; Testing. diff --git a/heap.lisp b/heap.lisp index 9f099c0..53eb2b8 100644 --- a/heap.lisp +++ b/heap.lisp @@ -117,7 +117,7 @@ (defun make-heap (&key (compare #'<=) (key #'identity) - (type 't) (init-size 16) (contents nil contentsp)) + (type 't) (init-size 16) (contents nil contentsp)) "Return a new heap. COMPARE is a partial-order predicate: (COMPARE X Y) should return true if diff --git a/infix.lisp b/infix.lisp index a77f51e..ff5a3c9 100644 --- a/infix.lisp +++ b/infix.lisp @@ -283,7 +283,7 @@ the value stack." `(progn (setf (get ',op ',kind) - (lambda () ,@body)) + (lambda () ,@body)) ',op)) (defmacro definfix (op prec &body body) @@ -427,7 +427,7 @@ (let ((stuff nil)) (loop (unless (symbolp *token*) - (error "expected symbol; found ~S" *token*)) + (error "expected symbol; found ~S" *token*)) (push *token* stuff) (get-token) (unless (delim '|,| nil) @@ -821,8 +821,8 @@ (defun foo (x) (- x 6))) ("bind x = 3 in x - 2" . (let ((x 3)) (- x 2))) ("bind x, y = values(1, 2), - z = 3, - docs, decls, body = parse-body(body) in complicated" . + z = 3, + docs, decls, body = parse-body(body) in complicated" . (multiple-value-bind (x y) (values 1 2) (let ((z 3)) (multiple-value-bind (docs decls body) (parse-body body) diff --git a/mdw-base.lisp b/mdw-base.lisp index 95b79de..df2acd3 100644 --- a/mdw-base.lisp +++ b/mdw-base.lisp @@ -195,7 +195,7 @@ (defmacro with-gensyms (syms &body body) "Everyone's favourite macro helper." `(let (,@(mapcar (lambda (sym) `(,sym (gensym ,(symbol-name sym)))) - (listify syms))) + (listify syms))) ,@body)) (defmacro let*/gensyms (binds &body body) @@ -204,16 +204,16 @@ each VAR is bound to a gensym, and in the final expansion, each of those gensyms will be bound to the corresponding VALUE." (labels ((more (binds) - (let ((tmp (gensym "TMP")) (bind (car binds))) - `((let ((,tmp ,(cadr bind)) - (,(car bind) (gensym ,(symbol-name (car bind))))) - `(let ((,,(car bind) ,,tmp)) - ,,@(if (cdr binds) - (more (cdr binds)) - body))))))) + (let ((tmp (gensym "TMP")) (bind (car binds))) + `((let ((,tmp ,(cadr bind)) + (,(car bind) (gensym ,(symbol-name (car bind))))) + `(let ((,,(car bind) ,,tmp)) + ,,@(if (cdr binds) + (more (cdr binds)) + body))))))) (if (null binds) - `(progn ,@body) - (car (more (mapcar #'pairify (listify binds))))))) + `(progn ,@body) + (car (more (mapcar #'pairify (listify binds))))))) ;;;-------------------------------------------------------------------------- ;;; Some simple yet useful control structures. @@ -227,7 +227,7 @@ collect val into vals finally (return (values vars vals))) `(labels ((,name ,vars - ,@body)) + ,@body)) (,name ,@vals)))) (defmacro while (cond &body body) @@ -253,7 +253,7 @@ (list `(let ((,(or vary varx) ,argument) ,@(and vary `((,varx ,scrutinee)))) - ,@forms)) + ,@forms)) forms)))) clauses))))) @@ -318,29 +318,29 @@ (if (null places) `(progn ,@body) (let*/gensyms (environment) - (labels - ((more (places) - (let ((place (car places))) - (with-gensyms (tmp valtmps valforms - newtmps setform getform) - `((let ((,tmp ,(cadr place)) - (,(car place) - (gensym ,(symbol-name (car place))))) - (multiple-value-bind - (,valtmps ,valforms - ,newtmps ,setform ,getform) - (get-setf-expansion ,tmp - ,environment) - (list 'let* - (mapcar #'list ,valtmps ,valforms) - `(symbol-macrolet ((,,(car place) - (%place-ref ,,getform - ,,setform - ,,newtmps))) - ,,@(if (cdr places) - (more (cdr places)) - body)))))))))) - (car (more (mapcar #'pairify (listify places)))))))) + (labels + ((more (places) + (let ((place (car places))) + (with-gensyms (tmp valtmps valforms + newtmps setform getform) + `((let ((,tmp ,(cadr place)) + (,(car place) + (gensym ,(symbol-name (car place))))) + (multiple-value-bind + (,valtmps ,valforms + ,newtmps ,setform ,getform) + (get-setf-expansion ,tmp + ,environment) + (list 'let* + (mapcar #'list ,valtmps ,valforms) + `(symbol-macrolet ((,,(car place) + (%place-ref ,,getform + ,,setform + ,,newtmps))) + ,,@(if (cdr places) + (more (cdr places)) + body)))))))))) + (car (more (mapcar #'pairify (listify places)))))))) ;;;-------------------------------------------------------------------------- ;;; Update-in-place macros built using with-places. @@ -385,7 +385,7 @@ (get-setf-expansion place env) `(let* (,@(mapcar #'list valtmps valforms)) (make-loc (lambda () ,getform) - (lambda (,@newtmps) ,setform))))) + (lambda (,@newtmps) ,setform))))) (declaim (inline loc (setf loc))) diff --git a/mdw-mop.lisp b/mdw-mop.lisp index 7af8ad9..e744fcd 100644 --- a/mdw-mop.lisp +++ b/mdw-mop.lisp @@ -368,27 +368,27 @@ (defun print-object-with-slots (obj stream) "Prints objects in a pleasant way. Not too clever about circularity." (let ((class (class-of obj)) - (magic (cons 'magic nil))) + (magic (cons 'magic nil))) (print-unreadable-object (obj stream) (pprint-logical-block - (stream - (mapcan (lambda (slot) - (list (or (car (slot-definition-initargs slot)) - (slot-definition-name slot)) - (if (slot-boundp-using-class class obj slot) - (slot-value-using-class class obj slot) - magic))) - (class-slots class))) - (format stream "~S" (class-name class)) - (let ((sep nil)) - (loop - (pprint-exit-if-list-exhausted) - (if sep - (format stream " ~_") - (progn (format stream " ~@_~:I") (setf sep t))) - (let ((name (pprint-pop)) - (value (pprint-pop))) - (format stream "~S ~@_~:[~W~;#~*~]" - name (eq value magic) value)))))))) + (stream + (mapcan (lambda (slot) + (list (or (car (slot-definition-initargs slot)) + (slot-definition-name slot)) + (if (slot-boundp-using-class class obj slot) + (slot-value-using-class class obj slot) + magic))) + (class-slots class))) + (format stream "~S" (class-name class)) + (let ((sep nil)) + (loop + (pprint-exit-if-list-exhausted) + (if sep + (format stream " ~_") + (progn (format stream " ~@_~:I") (setf sep t))) + (let ((name (pprint-pop)) + (value (pprint-pop))) + (format stream "~S ~@_~:[~W~;#~*~]" + name (eq value magic) value)))))))) ;;;----- That's all, folks -------------------------------------------------- diff --git a/optparse.lisp b/optparse.lisp index 09050f6..73d9619 100644 --- a/optparse.lisp +++ b/optparse.lisp @@ -426,8 +426,8 @@ (progn ,@body) (simple-condition (,cond) (apply #'die - (simple-condition-format-control ,cond) - (simple-condition-format-arguments ,cond))) + (simple-condition-format-control ,cond) + (simple-condition-format-arguments ,cond))) (error (,cond) (die "~A" ,cond))))) diff --git a/str.lisp b/str.lisp index 5cf05aa..a943bae 100644 --- a/str.lisp +++ b/str.lisp @@ -37,7 +37,7 @@ (with-output-to-string (s) (when strs (loop - (princ (stringify (pop strs)) s) + (princ (stringify (pop strs)) s) (unless strs (return)) (princ del s))))) diff --git a/sys-base.lisp b/sys-base.lisp index 370e80e..bef7ce9 100644 --- a/sys-base.lisp +++ b/sys-base.lisp @@ -53,7 +53,7 @@ #+sbcl sb-ext:*posix-argv* #+ecl (loop from i below (ext:argc) collect (ext:argv i)) #+clisp (loop with argv = (ext:argv) - for i from 7 below (length argv) + for i from 7 below (length argv) collect (aref argv i)) '("" "--" ""))) (setf *program-name* (pathname-name (car *command-line*)))) diff --git a/unix.lisp b/unix.lisp index f82fbf1..be823f0 100644 --- a/unix.lisp +++ b/unix.lisp @@ -130,8 +130,8 @@ `(defstruct (stat (:predicate statp) (:conc-name st-) (:constructor %make-stat-boa ,slots)) - ,doc - ,@slots))) + ,doc + ,@slots))) (doit "Structure representing all the useful information `stat' returns about a file." @@ -184,7 +184,7 @@ to (logior unix:O_WRONLY unix:O_CREAT how) (logand (st-mode st) #o777)) - (sys-fchmod out (st-mode st)) + (sys-fchmod out (st-mode st)) (sys-utimes to (st-atime st) 0 (st-mtime st) 0) (with-errno-handlers () (sys-fchown out (st-uid st) (st-gid st))