【发布时间】:2018-01-07 04:59:10
【问题描述】:
我正在尝试在列表中的搜索原子之后添加一个新原子。
当我尝试递归调用函数 appendConst 时,我收到以下错误 -
[1]> (defun appendConst (OLD NEW L)
(cond
((null L) ())
((EQ (car L) OLD) (appendConst (cons OLD (cons NEW (cdr L)))) )
(T (cons (car L) (appendConst OLD NEW (cdr L))))
))
APPENDCONST
[2]> (appendConst 'a 'd '(a c d e a m k))
*** - EVAL/APPLY: Too few arguments (1 instead of at least 3) given to APPENDCONST
The following restarts are available:
ABORT :R1 Abort main loop
Break 1 [3]>
在这里,使用我的输入,在每次出现“a”之后,我想在给定的整个列表中添加一个“d”。
我是新手,如何在这里递归调用函数?
TIA。
【问题讨论】: