Recursive Procedures
A procedure may be defined in terms of itself.
> (define (factorial n)
; Returns factorial of N.
(if (= n 1) 1
(* n (factorial (- n 1))) ) )
> (factorial 5)
120
> (factorial 20)
2432902008176640000
Previous slide
Next slide
Back to first slide
View graphic version