Why won't this little Lisp expression work? -
This is my first day of Lisp. I'm finally trying to write another statement ... hopefully this Years will be some time. I'm not sure why this is giving me an error?
(cond (<1 2) (print "hey"))
Why it crashed? It says that variable '& lt;' Is unbound? I'm not exactly getting Lisp ... Thanks in advance.
cond
takes a list of trials and segments
(cond ( gt; & gt; if test is true & gt;) ( & lt; if test2 is true & gt;) ...) < / Code> I think you want to write
(cond ((<1) (print "hey") ;; if 1 2 Print less "O"
what is actually found in your question
(cond (<1; 2) ;; If `
, None of these symbols is defined by default in the variable namespace, so you will get an error.
< P> If you have only one form dispatch, and only want to do something if it is true, use when to cond
. Is more common. (when (& lt; 1 2) (print "hey"))
Comments
Post a Comment