]> git.rkrishnan.org Git - sicp.git/blob - src/sicp/ex2_17.clj
Merge branch 'master' of github.com:vu3rdd/sicp
[sicp.git] / src / sicp / ex2_17.clj
1 (ns sicp.ex2_17
2   (:use [sicp utils ch2_2]
3         [clojure test]))
4
5 (defn last-pair [lst]
6   (if (= (length lst) 1)
7     lst
8     (last-pair (rest lst))))
9
10 (deftest test-last-pair-1
11   (are [x y] [= x y]
12        (last-pair (list 1 2 3 4)) (list 4)
13        (last-pair (list 23 72 149 34)) (list 34)))