Reputation: 149
I am trying to learn Common Lisp following C. Shapiro's Common Lisp: An interactive approach. I try to define the type bstree from chapter 18. My code is the following
(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))))
When I feed it to slime it gives the error Undefined variable:ELEMENT
. What is wrong and how can I define the bstreep
function?
Upvotes: 0
Views: 107
Reputation: 29021
Have you tried to use the quoted form this way in all the typep
usages?:
(typep tree 'element)
Upvotes: 4