/usr/lib/factorial.scm is in scheme9 2013.11.26-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ; Scheme 9 from Empty Space, Function Library
; By Nils M Holm, 2009
; Placed in the Public Domain
;
; (factorial integer) ==> integer
;
; Compute the factorial of a number.
;
; Example: (factorial 30) ==> 265252859812191058636308480000000
(define (factorial n)
(letrec
((r* (lambda (n m)
(if (< m 2)
n
(let ((k (quotient m 2)))
(* (r* n k)
(r* (+ n k) (- m k))))))))
(cond ((negative? n)
(error "factorial: negative operand" n))
(else
(r* 1 n)))))
|