9 lines
194 B
Racket
9 lines
194 B
Racket
#lang racket
|
|
(define (fact n)
|
|
(cond
|
|
[(zero? n) 1]
|
|
[else (* n (fact (sub1 n)))]))
|
|
|
|
(module+ test
|
|
(require rackunit)
|
|
(check-equal? (fact 10) 3628800)) |