本文介绍了Lisp非法函数调用,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 下面的代码继续引发以下错误: c> c> c> - IF 与其他形式是: 表单不能以两个括号开头 - 只有一个例外:((lambda(x)(+ x 1))2)。 如果要分组多个表达式例如(progn abc ... z)。 The code below keeps throwing the following error: caught ERROR:illegal function call (LET ((SOLUTION 'NIL) (FIRST 0) (SECOND 0)) (DOLIST (EL LST) (IF (NUMBERP EL) (PUSH EL SOLUTION) ((SETF #) (SETF #) (PUSH # SOLUTION)))) (CAR SOLUTION))Can anyone see why? Syntactically I can't see anything wrong with it.Note: I'm using sbcl.My code:(defun evalpostfix (lst) (let ((solution '()) (first 0) (second 0)) (dolist (el lst) (if (numberp el) ;if (push el solution) ;then ((setf second (pop solution)) ;else (setf first (pop solution)) (push (funcall el first second) solution)))) (car solution))) 解决方案 ((setf second (pop solution)) - two opening parentheses? Why? The syntax for IF with an else form is:(if test-form then-form else-form)A form cannot begin with two parentheses - there is only one exception: ((lambda (x) (+ x 1)) 2).If you want to group more than one expression use something like (progn a b c ... z). 这篇关于Lisp非法函数调用,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-18 10:44