我正在编写一些获取设定长度列表的诡计代码,我需要为列表中的每个元素定义一个变量。目前,我必须做这样的事情:
(define (foo l)
(let ((e-1 (car l))
(e-2 (cadr l))
(e-2 (caddr l))
; ...
(e-n (list-ref (- n 1)
l)))
(compute)))
这变得超级乏味。无论如何我可以做这样的事情吗?
(define (foo l)
(symbol-def e-1 e-2 e-3 e-4 e-n l)
(compute))
编辑:使问题更加狡猾。