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

Exercise 4.68 · 习题

Exercise 4.68: Define rules to implement the

reverse operation of Exercise 2.18, which returns a list

containing the same elements as a given list in reverse order. (Hint: Use

append-to-form.) Can your rules answer both (reverse (1 2 3) ?x)

and (reverse ?x (1 2 3))?

练习 4.68:定义规则以实现练习 2.18 中的 reverse 操作,该操作返回一个包含给定表中所有元素但顺序相反的表。(提示:使用 append-to-form。)你的规则能否同时回答 (reverse (1 2 3) ?x) 和 (reverse ?x (1 2 3)) 这两类查询?