(defmethod! expand-t-setclass (pcset &optional (n 12))
:icon *PC_ICON*
:doc "
Given any member of a t-setclass, lists every member of that t-setclass.
The optional parameter N can be used to set the number of equal steps per
octave to something other than the default of 12.
Will tolerate integers out of the mod-N range in PCSET."
:initvals '((1 3 4) 12)
:indoc '("pcset or list of them"
"modulus of the pc space")
(if (listp (first pcset))
(expand-t-setclasses pcset)
(let ((t-prime (t-primeform pcset n)))
(loop with result = nil
repeat n
for x-pcset = pcset then (xpose x-pcset 1 n)
unless (member x-pcset result) collect x-pcset into result
finally return result))))
(defmethod! expand-t-setclasses (pcset &optional (n 12))
(loop for item in pcset collect (expand-t-setclass item n)))
;-----
我对Lisp一般不太熟悉,并试图找到导致此错误的错误:
错误:LOOP中的重复绑定:(结果)
答案 0 :(得分:1)
LOOP中有两个表单,引入了一个变量RESULT。
WITH result = nil
和
COLLECT ... INTO result
以上两者都创建了一个变量绑定。
我会用一个将项目推送到RESULT列表的表单替换COLLECT。
(loop ...
collect item into foo
...
finally (return foo))
到
(loop with foo = nil
...
(push item foo)
...
finally (return (reverse foo)))
您还有其他错误:
FINALLY RETURN result
LOOP语法不支持。最后期望复合形式。
将其替换为:
FINALLY (return result)
RETURN是Common Lisp中定义的宏。