【发布时间】:2010-09-24 21:17:13
【问题描述】:
我对 lisp 还是很陌生;我想知道这里是否有人可以帮助我。
我有以下代码sn-p:
(defun write-lookup (binding-list pattern fact)
(cond
; No bindings have been stored
; Return the binding list with a new one!
((not binding-list) (cons (cons pattern fact) nil))
; A list of bindings is being stored
(cond
; The current binding matches
((equal (caar binding-list) pattern)
; Return the binding-list if value matches, nil else
(if (compare pattern fact) binding-list nil))
; Recursively search the rest of the list for the binding
((cdr binding-list) (write-lookup (cdr binding-list) pattern fact))
; The list doesn't have the binding.
; Return the binding-list with the added pattern
( T (cons (cons pattern fact) binding-list)))))
当我尝试运行它时,我得到以下信息:
*** - SYSTEM::%EXPAND-FORM: (EQUAL (CAAR BINDING-LIST) PATTERN) should be a
lambda expression
有人可以指出我的错误吗?谢谢!
【问题讨论】:
标签: lisp common-lisp