#lang racket ;; Don't worry about the details of the procedure definition for now. ;; We'll learn how to write such programs later. For now, just look ;; at the answers it provides. For fun, you can load the definition ;; into Dr. Racket and try your own procedure calls. Observe (1) how ;; fast it is! and (2) how it does not overflow the system stack! (define factorial (lambda (n) (letrec ((accumulate (lambda (n answer) (if (zero? n) answer (accumulate (- n 1) (* n answer)))))) (accumulate n 1))))