Lisp 公共口齿不清。德芬监狱

Lisp 公共口齿不清。德芬监狱,lisp,common-lisp,Lisp,Common Lisp,我正在做一个插入列表函数。它看起来像: (defun INSERT1 (x y) (setq temp (list x y)) (setq k (sort temp #'< :key #'car))) (defun INSERT2 (x y) (setq temp (cons x y)) (setq k (sort temp #'< :key #'car))) 所以我做了这个: (defun INSERT1 (x y) (setq temp (list x y)) (setq k

我正在做一个插入列表函数。它看起来像:

(defun INSERT1 (x y)
(setq temp (list x y))
(setq k (sort temp #'< :key #'car)))

(defun INSERT2 (x y)
(setq temp (cons x y))
(setq k (sort temp #'< :key #'car)))
所以我做了这个:

(defun INSERT1 (x y)
(setq temp (list x y))
(setq k (sort temp #'< :key #'car)))

(defun INSERT2 (x y)
(setq temp (cons x y))
(setq k (sort temp #'< :key #'car)))

(defun INSERTCELL (x y)
(setq temp nil)
(cond
((eq (car temp) nil) (INSERT1 (x y))
(t (INSERT2 (x y))))))
如何在这个问题上使用“cond”而没有错误


请教我正确的代码

在通用Lisp和其他Lisp中,foo。。。始终指以下各项之一:

调用函数FOO 展开宏FOO 跟特别接线员FOO做点什么
如果您习惯于使用非lisp编程语言,那么您通常会将其编写为foo。。。写为foo…

INSERT1 x y应该是INSERT1 x y,否则x被解释为应用于y.oh的函数。。谢谢伦佐。现在可以了。
(defun INSERT1 (x y)
(setq temp (list x y))
(setq k (sort temp #'< :key #'car)))

(defun INSERT2 (x y)
(setq temp (cons x y))
(setq k (sort temp #'< :key #'car)))

(defun INSERTCELL (x y)
(setq temp nil)
(cond
((eq (car temp) nil) (INSERT1 (x y))
(t (INSERT2 (x y))))))
*** - EVAL: undefined function X