CS2613/labs/L04/recursion.rkt
2022-09-22 16:16:55 -03:00

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))