3 (:refer-clojure :exclude (reverse)))
6 (reduce #(cons %2 %1) '() lst))
10 (let [reverse (fn [lst1 lst2]
13 (recur (rest lst1) (cons (first lst1) lst2))))]
20 (cons (last lst) (reverse-3 (butlast lst)))))
22 (deftest test-reverse-1
24 (reverse-1 (list 1 2 3 4)) (list 4 3 2 1)
25 (reverse-1 (list 1 4 9 16 25)) (list 25 16 9 4 1)
26 (reverse-1 (list (list 1 2) (list 3 4))) (list (list 3 4) (list 1 2))))
28 (deftest test-reverse-2
30 (reverse-2 (list 1 2 3 4)) (list 4 3 2 1)
31 (reverse-2 (list 1 4 9 16 25)) (list 25 16 9 4 1)
32 (reverse-1 (list (list 1 2) (list 3 4))) (list (list 3 4) (list 1 2))))