4clojure
nth 구현 (no.21)
(defn nnth [c n]
(if (= n 0)
(first c)
(nnth (rest c) (dec n))))답
(fn [c n]
(if (= n 0)
(first c)
(recur (rest c) (dec n))))count 구현 (no.22)
(defn countt
([c n]
(if (empty? c)
n
(countt (rest c) (inc n))) )
([c]
(countt c 0)))답 (loop, recur 활용)
reverse 구현 (no.23)
Last updated