chore: testing
This commit is contained in:
parent
76b279a8a8
commit
29d2e90377
1 changed files with 13 additions and 6 deletions
|
|
@ -3,25 +3,32 @@
|
||||||
|
|
||||||
(defn is-even? [n]
|
(defn is-even? [n]
|
||||||
(if (= n 0)
|
(if (= n 0)
|
||||||
__
|
true
|
||||||
(___ (is-even? (dec n)))))
|
(not (is-even? (dec n)))))
|
||||||
|
|
||||||
(defn is-even-bigint? [n]
|
(defn is-even-bigint? [n]
|
||||||
(loop [n n
|
(loop [n n
|
||||||
acc true]
|
acc true]
|
||||||
(if (= n 0)
|
(if (= n 0)
|
||||||
__
|
acc
|
||||||
(recur (dec n) (not acc)))))
|
(recur (dec n) (not acc)))))
|
||||||
|
|
||||||
(defn recursive-reverse [coll]
|
(defn recursive-reverse [coll]
|
||||||
__)
|
(if (empty? coll)
|
||||||
|
[]
|
||||||
|
(conj (recursive-reverse (rest coll)) (first coll)))
|
||||||
|
)
|
||||||
|
|
||||||
(defn factorial [n]
|
(defn factorial [n]
|
||||||
__)
|
(if (zero? n)
|
||||||
|
1
|
||||||
|
(if (false? (= c 1))
|
||||||
|
)
|
||||||
|
))
|
||||||
|
|
||||||
(meditations
|
(meditations
|
||||||
"Recursion ends with a base case"
|
"Recursion ends with a base case"
|
||||||
(= true (is-even? 0))
|
(= true (is-even? 4))
|
||||||
|
|
||||||
"And starts by moving toward that base case"
|
"And starts by moving toward that base case"
|
||||||
(= false (is-even? 1))
|
(= false (is-even? 1))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue