summary refs log tree commit diff stats
path: root/factorial.lith
blob: 2349fb732bf8ad7232069488b5f79c3040518f45 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
;;;; factorial.lith
;;;; the factorial program written in lith

(define (! n)
    (if (< n 2)
        1
        (* n (! (- n 1)))))

(define (fac n)
    (apply * (range 1 n)))

(print (! 5) (! 6))
(print (fac 10))