Lisp:EVAL/APPLY:提供给 INSERTBST 错误的参数太少(1 个而不是至少 2 个)
Lisp: EVAL/APPLY: Too few arguments (1 instead of at least 2) given to INSERTBST error
有谁知道为什么我收到此代码的 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))))
有谁知道为什么我收到此代码的 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))))