next up previous contents
Next: Calculating the sum of Up: Examples for recursion Previous: Examples for recursion   Contents


Calculating the faculty of a number


(define fac
   (lambda(n)
   (if (equaln n one)
      one
      (mult n (fac (sub n one))))))


(ndisp! (fac five))
                             --> 120



Georg P. Loczewski 2004-03-05


Impressum und Datenschutz