用列表获得结果

时间:2013-02-22 16:22:04

标签: list scheme

;如何在'b'中获取'a'的值?

;不想在'b'中分配字母'a',想要'a'中包含的值

(define a 5)
(define c '(a c))
(define b (car c))
(display b)

1 个答案:

答案 0 :(得分:1)

(define a 5)
(define c (list a 'c))
(define b (car c))
(display b)

'等同于quote程序。所以'(a c) => (list 'a 'c)

请参阅:http://www.gnu.org/software/mit-scheme/documentation/mit-scheme-ref/Quoting.html#Quoting

或者,使用您的原始代码,您是否会问{J 1}}