我有一些代码:
(defun divisor (x)
(loop for i from 2 to x do
(if (= x i) (return x)
(if (not (mod x i))
(return (append i (divisor (/ x i))))))))
Run Code Online (Sandbox Code Playgroud)
应该返回x的素因子列表.但是,代码只返回x.
defun评估没有错误.我试图跟踪defun中的每个函数,并且没有任何函数被评估过.循环是一个宏,所以我无法追踪它,但如果我清除循环内部并替换为
(format t "~d " i)
Run Code Online (Sandbox Code Playgroud)
它从2到x计数,就像我期望的那样.
我认为我做错了什么,但我无法理解.
我知道单引号包围的字符串可以包含双引号,反之亦然,但字符串是否包含两个?例如,字符串:
How do you say, "Where's the bathroom?" in Spanish?
Run Code Online (Sandbox Code Playgroud)