Fix 12 exercise defects from review wave 1 (scouts a+d)
This commit is contained in:
1 parent
3f753b2a8f
commit
2735c8dca5
18 files changed
+49
-5
No files matched your search
@@ -14,5 +14,6 @@
|
||||
(check-equal '("hi" "hi") (repeat-word "hi"))
|
||||
(check-equal '("hi" "hi" "hi" "hi") (repeat-word "hi" 4))
|
||||
(check-equal '(:width 2 :height 2 :depth 2) (make-box 2))
|
||||
(check-equal '(:width 3 :height 3 :depth 3) (make-box 3))
|
||||
(check-equal '(:width 2 :height 5 :depth 2) (make-box 2 :height 5))
|
||||
(check-equal '(:width 2 :height 5 :depth 7) (make-box 2 :height 5 :depth 7))
|
||||
@@ -1,4 +1,7 @@
|
||||
;;; FUNCTIONS 4: MULTIPLE VALUES (solution)
|
||||
;;;
|
||||
;;; The checks below gather the values with MULTIPLE-VALUE-LIST,
|
||||
;;; turning them into a list.
|
||||
|
||||
(defun divide (a b)
|
||||
(floor a b))
|
||||
|
||||
@@ -20,3 +20,4 @@
|
||||
|
||||
(check-equal "yum" (catch-empty '(a b)))
|
||||
(check-equal "soup" (catch-empty '()))
|
||||
(check-error (eat '()) 'empty-plate)
|
||||
@@ -21,3 +21,8 @@
|
||||
(check-equal 1 (car-with-default '(1 2 3)))
|
||||
(check-equal nil (car-with-default "not a list"))
|
||||
(check-equal nil (car-with-default nil))
|
||||
(check-equal nil
|
||||
(handler-bind ((error (lambda (e)
|
||||
(declare (ignore e))
|
||||
(invoke-restart (find-restart 'use-nil)))))
|
||||
(safe-car "not a list")))
|
||||
@@ -18,3 +18,6 @@
|
||||
(check (eql 0 (current-depth)))
|
||||
(check (eql 3 (let ((*depth* 3)) (current-depth))))
|
||||
(check (eql 0 (current-depth)))
|
||||
(check (eql 42 (let ((*depth* 42))
|
||||
(with-depth 7 (lambda () nil))
|
||||
(current-depth))))
|
||||
@@ -3,7 +3,7 @@
|
||||
(defun eval-expr (expr)
|
||||
(cond ((numberp expr) expr)
|
||||
((and (consp expr) (eq 'quote (car expr)))
|
||||
(second expr))
|
||||
(car (cdr expr)))
|
||||
((and (consp expr) (member (car expr) '(+ - *)))
|
||||
(apply (car expr) (mapcar #'eval-expr (cdr expr))))
|
||||
(t (error "cannot evaluate ~s" expr))))
|
||||
|
||||
Reference in new issue
Block a user