Exercise 2.66. Implement the lookup procedure for the case where the set of records is structured as a binary tree, ordered by the numerical values of the keys.
即 binary tree 中的 element-of-set? 过程:
(define (lookup x set)
(cond ((null? set) false)
((= x (key (entry set))) (entry set))
((< x (key (entry set)))
(lookup x (left-branch set)))
((> x (key (entry set)))
(lookup x (right-branch set)))))