(define nth-element (lambda (ls n) (cond [(null? ls) "error"] [(zero? n) (car ls)] [else (nth-element (cdr ls) (- n 1))]))) (define nth-element (lambda (ls n) (if (null? ls) "error" (if (zero? n) (car ls) (nth-element (cdr ls) (- n 1))]))) (define fact (lambda (n) (cond [(zero? n) 1] [(negative? n) "Error: negative input to fact"] [else (* n (fact (- n 1)))]))) (define fact2 (lambda (n) (if (or (negative? n) (not (integer? n))) "error" (fact-acc n 1)))) ; acc stands for accumulator (define fact-acc (lambda (n acc) (if (zero? n) acc (fact-acc (- n 1) (* n acc))))) (fact2 4)