本文主要是介绍sicp 习题2.24 2.25,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
它的盒子图形如下:
(1 (2 (3 4))) ((2 (3 4)))
[*]---------------> [*]| || |v v (2 (3 4)) ((3 4))1 [*]---------------> [*]| || |v v (3 4) (4)2 [*]---------------> [*]---------------> '()| || |v v3 4
它的树图形如下:(1 (2 (3 4)))*/ \/ \ (2 (3 4))
1 */ \/ \ (3 4)2 */ \/ \3 4
习题2.5
(define x (list 1 3 (list 5 7) 9))
run:
Welcome to DrRacket, version 5.3.3 [3m].
Language: planet neil/sicp; memory limit: 512 MB.
> (car (cdr (car (cdr (cdr x)))))
7
>
#lang planet neil/sicp
(define x (list (list 7)))
run:
> (car x)
(mcons 7 '())
> (caar x)
7
>
(define x (list 1 (list 2 (list 3 (list 4 (list 5 (list 6 7)))))))
run:
> (car (cdr (car (cdr (car (cdr (car (cdr (car (cdr (car (cdr x))))))))))))
7
>
这篇关于sicp 习题2.24 2.25的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!