projects
/
sicp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e29af8c
)
adding the key lookup procedure
author
Ramakrishnan Muthukrishnan
<vu3rdd@gmail.com>
Sun, 12 Sep 2010 18:11:08 +0000
(23:41 +0530)
committer
Ramakrishnan Muthukrishnan
<vu3rdd@gmail.com>
Sun, 12 Sep 2010 18:11:08 +0000
(23:41 +0530)
src/sicp/ch2_3.clj
patch
|
blob
|
history
diff --git
a/src/sicp/ch2_3.clj
b/src/sicp/ch2_3.clj
index a69973c95cfd54d55745294c714f8d1db412d4cf..55ef8adbb5c3631bcff8497c5cba84bf278ac2c1 100644
(file)
--- a/
src/sicp/ch2_3.clj
+++ b/
src/sicp/ch2_3.clj
@@
-136,3
+136,9
@@
(left-branch set)
(adjoin-set x (right-branch set)))))
+
+;;; key lookup
+(defn lookup [given-key set-of-records]
+ (cond (empty? set-of-records) false
+ (equal? given-key (key (first set-of-records))) (first set-of-records)
+ :else (lookup given-key (rest set-of-records))))
\ No newline at end of file