whalesong/racketcon/fact.rkt

9 lines
125 B
Racket

#lang planet dyoo/whalesong
(provide fact)
(define (fact x)
(cond
[(= x 0)
1]
[else
(* x (fact (sub1 x)))]))