【发布时间】:2020-03-20 02:15:15
【问题描述】:
我正在尝试在 clisp 中使用 cl-position,但是,每当我尝试运行代码时,都会收到以下错误:
Prinayas-MacBook-Pro:~ pchoubey$ clisp project1.lisp
*** - SYSTEM::%EXPAND-FORM:
(PRINT (CL-POSITION "bar" '("foo" "bar" "baz") :TEST 'EQUAL)) should be
a lambda expression
为什么会发生这种情况,我怎样才能让这段代码正常运行?作为参考,这是我的代码:
(defun answer-ynq()
(setq ROBOT '(IS_A_ROBOT ROBBIE))
(loop for x in ROBOT
do(
(print (cl-position "bar" '("foo" "bar" "baz") :test 'equal))
))
(setq KB (make-hash-table :test 'equal))
(setf (gethash '(IS_A_ROBOT ROBBIE) KB)'T)
(setf (gethash '(IS_A_PERSON BOB) KB) 'T)
(setf (gethash '(IS_CLEVER ROBBIE) KB) 'T)
(setf (gethash '(OWNS ALICE ROBBIE) KB) 'T)
)
(answer-ynq)
【问题讨论】:
标签: lisp common-lisp clisp