factorial   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/runtime/scheme.xtm

Implementation

(define factorial
   (lambda (x)
      (if (< x 0)
    (log-error 'Factorial 'does 'not 'accept 'negative 'numbers)
    (if (<= x 1) 1
        (* x (factorial (- x 1)))))))


Back to Index