我正在尝试学习C.Shapiro的通用Lisp:一种交互式的方法之后的Common。我试图从第18章中定义bstree类型。
(defun elementp (e)
(or (characterp e) (numberp e) (packagep e)))
(deftype element ()
'(satisfies elementp))
(defun bstreep (tree)
(or (typep tree element)
(and (listp tree)
(= (length tree) 3)
(typep (first tree) element))))当我给它添加黏液时,它会给出错误的Undefined variable:ELEMENT。什么是错误的,我如何定义bstreep函数?
发布于 2015-11-15 21:49:41
在所有typep用法中,是否尝试过以这种方式使用引用的表单?:
(typep tree 'element)https://stackoverflow.com/questions/33725478
复制相似问题