SICP 全笔记

Exercise 4.55. Give simple queries that retrieve the following information from the data base:

a. all people supervised by Ben Bitdiddle; b. the names and jobs of all people in the accounting division; c. the names and addresses of all people who live in Slumerville.

; a. all people supervised by Ben Bitdiddle;
(supervisor ?x (Ben Bitdiddle))

; b. the names and jobs of all people in the accounting division;
(job ?x (accounting . ?y))

; c. the names and addresses of all people who live in Slumerville.
(address ?x (Slumerville . ?y))

需要注意的是一个 list 中一个 pattern variable 只能匹配一个元素,如果要匹配多个需要加一个点,像 scheme 中参数传递那样。