sicp-4-2-3
Posted on 2015-03-12 20:27:03 +0900 in SICP
4.32
In the current version, car
is lazy as well, which makes it possible to build structures such as infinite tree
.
4.33
;'(a b c)-->(cons 'a (cons 'b (cons 'c '())))
((quoted? exp) (text-of-quotation exp env))
(define (list->cons lst)
(if (null? lst)
'()
(list 'cons
(list 'quote (car lst))
(list->cons (cdr lst)))))
(define (text-of-quotation exp env)
(let ((quoted-operand (cadr exp)))
(if (pair? quoted-operand)
(eval (list->cons quoted-operand) env)
quoted-operand)))
Hide Comments
comments powered by Disqus