projects
/
sbcl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
1.0.16.8: NCONC with dx &rest lists
[sbcl.git]
/
src
/
code
/
defboot.lisp
diff --git
a/src/code/defboot.lisp
b/src/code/defboot.lisp
index
5035116
..
16fd031
100644
(file)
--- a/
src/code/defboot.lisp
+++ b/
src/code/defboot.lisp
@@
-69,7
+69,8
@@
(defmacro-mundanely cond (&rest clauses)
(if (endp clauses)
nil
(defmacro-mundanely cond (&rest clauses)
(if (endp clauses)
nil
- (let ((clause (first clauses)))
+ (let ((clause (first clauses))
+ (more (rest clauses)))
(if (atom clause)
(error "COND clause is not a list: ~S" clause)
(let ((test (first clause))
(if (atom clause)
(error "COND clause is not a list: ~S" clause)
(let ((test (first clause))
@@
-79,22
+80,25
@@
`(let ((,n-result ,test))
(if ,n-result
,n-result
`(let ((,n-result ,test))
(if ,n-result
,n-result
- (cond ,@(rest clauses)))))
- `(if ,test
- (progn ,@forms)
- (cond ,@(rest clauses)))))))))
+ (cond ,@more))))
+ (if (eq t test)
+ `(progn ,@forms)
+ `(if ,test
+ (progn ,@forms)
+ ,(when more `(cond ,@more))))))))))
-;;; other things defined in terms of COND
(defmacro-mundanely when (test &body forms)
#!+sb-doc
"If the first argument is true, the rest of the forms are
(defmacro-mundanely when (test &body forms)
#!+sb-doc
"If the first argument is true, the rest of the forms are
- evaluated as a PROGN."
- `(cond (,test nil ,@forms)))
+evaluated as a PROGN."
+ `(if ,test (progn ,@forms) nil))
+
(defmacro-mundanely unless (test &body forms)
#!+sb-doc
"If the first argument is not true, the rest of the forms are
(defmacro-mundanely unless (test &body forms)
#!+sb-doc
"If the first argument is not true, the rest of the forms are
- evaluated as a PROGN."
- `(cond ((not ,test) nil ,@forms)))
+evaluated as a PROGN."
+ `(if ,test nil (progn ,@forms)))
+
(defmacro-mundanely and (&rest forms)
(cond ((endp forms) t)
((endp (rest forms)) (first forms))
(defmacro-mundanely and (&rest forms)
(cond ((endp forms) t)
((endp (rest forms)) (first forms))
@@
-102,6
+106,7
@@
`(if ,(first forms)
(and ,@(rest forms))
nil))))
`(if ,(first forms)
(and ,@(rest forms))
nil))))
+
(defmacro-mundanely or (&rest forms)
(cond ((endp forms) nil)
((endp (rest forms)) (first forms))
(defmacro-mundanely or (&rest forms)
(cond ((endp forms) nil)
((endp (rest forms)) (first forms))