灯下 登录
计算机科学 / SICP / 4.4.3 Is Logic Programming Mathematical Logic?

Exercise 4.65 · 习题

Exercise 4.65: Cy D. Fect, looking forward to
the day when he will rise in the organization, gives a query to find all the
wheels (using the wheel rule of 4.4.1):

(wheel ?who)

To his surprise, the system responds

;;; Query results:
(wheel (Warbucks Oliver))
(wheel (Bitdiddle Ben))
(wheel (Warbucks Oliver))
(wheel (Warbucks Oliver))
(wheel (Warbucks Oliver))

Why is Oliver Warbucks listed four times?

练习 4.65:Cy D. Fect 憧憬着自己在组织中出人头地的那一天,发出查询以找出所有的"核心人物"(使用 4.4.1 中的 wheel 规则):

(wheel ?who)

令他惊讶的是,系统的响应如下:

;;; Query results:
(wheel (Warbucks Oliver))
(wheel (Bitdiddle Ben))
(wheel (Warbucks Oliver))
(wheel (Warbucks Oliver))
(wheel (Warbucks Oliver))

Oliver Warbucks 为何被列出四次?

Racket #lang sicp
(wheel ?who)
Racket #lang sicp
;;; Query results:
(wheel (Warbucks Oliver))
(wheel (Bitdiddle Ben))
(wheel (Warbucks Oliver))
(wheel (Warbucks Oliver))
(wheel (Warbucks Oliver))