灯下 登录
计算机科学 / SICP / 3.3.1 Mutable List Structure

Exercise 3.18 · 习题

Exercise 3.18: Write a procedure that examines a

list and determines whether it contains a cycle, that is, whether a program

that tried to find the end of the list by taking successive cdrs would

go into an infinite loop. Exercise 3.13 constructed such lists.

练习 3.18:编写一个过程,检查一个表并判断其是否包含环,即:若某个程序试图通过连续取 cdr 来找到表的末尾,它是否会陷入无限循环。练习 3.13 构造了这样的表。