SICP车/ cdr练习题问题

ehs*_*nul 3 lisp scheme sicp

我在这里为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
Run Code Online (Sandbox Code Playgroud)

仅使用car,cdr和其值为下面给出的列表结构的东西.

(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)
Run Code Online (Sandbox Code Playgroud)

还有另一种方法吗?

ehs*_*nul 6

看起来我只是在傻.这很好用:

(cdr(cdr(cdr thing)))
Run Code Online (Sandbox Code Playgroud)