ここでSICPの「オンライン チューター」を試しています。
私は次の質問を見ています:
すでにフォームを評価していると仮定します
(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、および thing のみを使用します。
(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)
これを行う別の方法はありますか?