"SICP Exercise" 93 Exercise 2.66

Source: Internet
Author: User

Exercise 2.66

This problem is equivalent to two fork tree in the actual project of one application, we still need to use the previous three processes learned: entry, Left-branch, Right-branch. The three functions are taking out the node, the left branch and the right branch. And according to the topic request, here also need a key that gets the value. Of course, as shown in the book above, key does not need to be written out, and here is a desire to think.

(Define (lookup given-key tree-of-records)   (if (null? tree-of-records)#f( Let (entry-key ( key (entry tree-of-records )))         (Cond ((= given-key entry-key) (entry tree-of-records))               (> given-key entry-key) (lookup given-key (right-branch tree-of-records )))                (< given-key entry-key) (lookup given-key (left-branch Tree-of-records )))))))

"SICP Exercise" 93 Exercise 2.66

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.