EVAL/APPLY:给F的参数太多了

Bog*_* M. 0 lisp clisp common-lisp

您好我为什么要*** - EVAL/APPLY: too many arguments given to F使用嵌套列表参数进行函数调用.我无法理解,因为我通过了一个简单的嵌套列表.

(defun f (L) 
    (cond 
        ((NULL l) nil)
        ((listp (car L)) 
            (append (F(car L))) (F(cdr L) (car (F (car L)))))
        (T (list(car L)))
    )
)

(setq A '((1) 2 3))
(f A)
Run Code Online (Sandbox Code Playgroud)

Rai*_*wig 5

这种更好的格式化应该可以很容易地发现错误:

(defun f (l) 
  (cond ((null l) nil)
        ((listp (car l)) 
         (append (f (car l)))
         (f (cdr l)
            (car (f (car l)))))
        (t (list (car l)))))
Run Code Online (Sandbox Code Playgroud)

如果这没有用,请使用SBCL编译该函数.它会给你一个非常明确的错误信息.