;Chapter 6, Bryan Test 2, Page 114-116 (defun my-length (l) (if (null l); if the list is mt, return 0 0 (+ 1 (my-length (cdr l))))); adds 1 to the return value of the cdr of the list. (defun my-member (elt l &optional (fn #'equal)) (if (null l) ;if list is mt, return nil nil (if (funcall fn (car l) elt) ;if the keys match, return t t (my-member elt (cdr l) fn)))); if more of the list exists, return the value of self called with the cdr of the list (defun my-copy-tree (l) (if (atom l);if l is a value or nil, return l l (if (consp l) ;if l is a conscell, return the cons of the of the copied left and right branches. (cons (my-copy-tree (car l)) (my-copy-tree (cdr l))) nil)));else return nil (defun my-fib (n) ;BAD TO USE b/c its unefficient. (if (<= n 1);if n is less than or equal to 1, return n n (+ (my-fib (- n 1)); else return fib of n - 1 added to fib of n -2 (my-fib (- n 2))))) (defun my-factorial (n) (if (= n 0) 1 (* n (my-factorial (- n 1))))) (deftest test-recursion-adv () (let ((x '(1 (2 3) 4))) (check (= (my-length (list 1 2 3 4 5 "a" 7 8 9 10 11)) 11) (my-member 5 (list 1 2 3 4 5 6 7 8 9 10)) (not (my-member 5 (list 1 2 3 4 6 7 8 9 10 11))) (equal (my-copy-tree x) x) (not (eql (my-copy-tree x) x)) (= (my-fib 20) 6765) (= (my-factorial 10) 3628800))))