【发布时间】:2025-12-20 20:00:16
【问题描述】:
我正在为 SICP 试用这个“在线导师”:http://icampustutor.csail.mit.edu/6.001-public/tutor.cgi?op=registration-page
我正在查看以下问题:
假设我们已经评估过 表格
(define thing (cons (cons (cons 1 nil) nil)
(cons (cons 2 (cons 3 (cons 4 nil)))
(cons 2
(cons 3 nil))))) Write expressions
只使用 car、cdr 和东西 values 是给定的列表结构 下面。
(1)
1
(2 3)
(3)
我对最后一个有问题。我想出了一种使用反引号和取消引号的方法,但是在线教程不会接受答案。使用鸡计划的解释器:
#;3> (define nil '())
#;4> (define thing (cons (cons (cons 1 nil) nil)
---> (cons (cons 2 (cons 3 (cons 4 nil)))
---> (cons 2
---> (cons 3 nil)))))
#;5>
#;5> thing
(((1)) (2 3 4) 2 3)
#;25> `(,(car(cdr(car(cdr thing)))))
(3)
还有其他方法吗?
【问题讨论】:
-
如果版主看到这个,请关闭它。
-
无需关闭,可以接受自答问题 :)
-
这看起来是一个很棒的网站,我正在尝试开始使用 sicp,我刚刚注册了。干杯!