Commit 64d0746e authored by Juergen Nickelsen's avatar Juergen Nickelsen
Browse files

027-when-unless.lisp and related fix

parent f768db10
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -440,15 +440,15 @@
          firstval
        (eval-list rest)))))

(defspecial unless (cond &rest body)
  "if COND yields nil, eval &rest BODY and return the result of the last"
(defspecial unless (cond &rest bodyforms)
  "if COND yields nil, eval &rest BODYFORMS and return the result of the last"
  (if (not (eval cond))
      (eval-list bodyforms)))

(defspecial when (cond &rest body)
  "if COND yields true, eval &rest BODY and return the result of the last"
(defspecial when (cond &rest bodyforms)
  "if COND yields true, eval &rest BODYFORMS and return the result of the last"
  (if (eval cond)
      (eval-list body)))
      (eval-list bodyforms)))

(defspecial cond (&rest clauses)
  (if (null clauses)

tests/notyet/027-when-unless.lisp

deleted100644 → 0
+0 −13
Original line number Diff line number Diff line

(defun false ()
  nil)

(defun true ()
  t)

(testcmp "when 0" '(when (false) (+ 13 14) (* 15 16) 332) nil)
(testcmp "when 1" '(when (true) (+ 13 14) (* 15 16) 332) 332)
(testcmp "when 2" '(let (a) (when (true) (setq a 115) 19) a) 115)
(testcmp "unless 0" '(unless (false) (+ 13 14) (* 15 16) 332) 332)
(testcmp "unless 1" '(unless (true) (+ 13 14) (* 15 16) 332) nil)
(testcmp "unless 2" '(let (a) (unless (false) (setq a 115) 19) a) 115)