Basic Lisp question about short circuit evaluation

This page

tells me that the XLISP and and or forms do short-circuit evaluation, i. e. not necessarily evaluating all arguments of a form.

It is not explicit that cond or if short-circuits.

I was just debugging something and found my expectations that cond and if short-circuited to be false! If the condition of the if was true, the else-branch, which contained the call to aref, was getting evaluated anyway and aborting Nyquist. I had to reverse the sense of the test, and swap the if and the else branch to make it work.


Maybe you should offer some more Details.
It is not clear what you mean.

(defun myeval (exp env)           
  (princ "exp: ") (print exp)
  (princ "env: ") (print env)
  (evalhook exp #'myeval NIL env))
(setq *evalhook* #'myeval)        
(setf a t)
(if a
(print "true")
(error "stop"))

the code not even indicates that the else branch is looked at.

Yes, I made tests in the prompt that worked as expected. I may have found a very specific, peculiar bug in the lisp interpreter. It might only apply when the first of the two branches of if or of cond is supposed to return nil, and maybe not always.