Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,5 @@
(defn factorial [x]
(cond
(< x 0) nil
(= x 0) 1
(* x (factorial (dec x)))))

View file

@ -0,0 +1,7 @@
(defn factorial-iter [product counter max-count]
(if (> counter max-count)
product
(factorial-iter (* counter product) (inc counter) max-count)))
(defn factorial [n]
(factorial-iter 1 1 n))

View file

@ -0,0 +1,9 @@
(defn factorial [x]
(cond
(< x 0) nil
(= x 0) 1
(do
(var fac 1)
(for i 1 (inc x)
(*= fac i))
fac)))

View file

@ -0,0 +1,5 @@
(defn factorial [x]
(cond
(< x 0) nil
(= x 0) 1
(product (range 1 (inc x)))))