Closed phoe closed 4 years ago
A bugreport came via mail to me:
Dear Michal,
Last year and this year, I send a mail about the bug to xrme but no response. I hope you can check it.
sbcl> (cond nil) => COND clause is not a CONS: NIL. ecl> (cond nil) => COND: Illegal clause NIL. cmucl> (cond nil) => Cond clause should be a non-empty list: NIL. clisp> (cond nil) => COND: clause NIL should be a list. acl> (cond nil) => Error: NIL -- Illegal atomic clause in COND. lispworks> (cond nil) => Error: NIL -- Illegal atomic clause in COND. ccl> (cond nil) => nil
From CLHS:
cond {clause} => result clause::= (test-form form*)
Obviously test-form is required. So simple a bug, a famous implementation!
Solution:
(defmacro cond (&rest args &aux clause) (when args (setq clause (car args)) (when (atom clause) (error "Cond clause should be a non-empty list: ~S.") clause) (if (cdr clause) `(if ,(car clause) (progn ,@(cdr clause)) (cond ,@(cdr args))) (if (cdr args) `(or ,(car clause) (cond ,@(cdr args))) `(values ,(car clause))))))
Sincerely Fengjing Xiao
fixed in 417f576e4c7.
A bugreport came via mail to me:
Dear Michal,
Last year and this year, I send a mail about the bug to xrme but no response. I hope you can check it.
From CLHS:
Obviously test-form is required. So simple a bug, a famous implementation!
Solution:
Sincerely Fengjing Xiao