Lisp:EVAL/APPLY:给INSERTBST错误的参数太少(1而不是至少2)



有人知道我为什么会收到这段代码的EVAL/APPLY: Too few arguments (1 instead of at least 2) given to INSERTBST错误吗,谢谢。

(defun insertbst (E tree)
(cond ((null tree) (list E nil nil))
(( = E (car tree)) tree)
(( < E (car tree))
(list (car tree) (insertbst E (cadr tree))
(caddr tree)))
( t (list (car tree) (cadr tree) (insertbst E (caddr tree))))))

(print(insertbst'(8 (3 (1 () ()) (6 (4 () ())( 7 () ()))) (10 (()) (14 (13) ())))))

您应该用数字和树来调用它。顺便说一句,树中的一些节点没有两个后代,所以我纠正了这一点:

(insertbst 15 '(8 (3 (1 () ()) 
(6 (4 () ())
( 7 () ())))
(10 () 
(14 (13 () ())
()))))

=>(8 (3 (1 NIL NIL) (6 (4 NIL NIL) (7 NIL NIL))) (10 NIL (14 (13 NIL NIL) (15 NIL NIL))))

最新更新