;; deftests for figure 6.1: Utility Functions (deftest test-single? () (check (single? '(9)) (eql nil (single? '(9 9 9))) (eql nil (single? nil)))) (deftest test-append1() ;; add element to end of list (check (equal '(a b c d) (append1 '(a b c) 'd)))) (deftest test-map-int() (check (equal '(0 1 4 9 16) (map-int #'(lambda (x)(* x x)) 5)) (equal '(0 1 2 3 4 5 6 7 8 9) (map-int #'identity 10)))) (deftest test-filter() (check (equal '(12) (filter #'(lambda (x) (and (evenp x) (+ x 10))) '(1 2 3))))) (deftest test-most() (check (equal '(A B C) (most #'length '((a b) (a b c) (a))))))