OK, this is again a “(return '()) does not return”-bug.
What I did so far:
I modified the last loop into:
(defun run ()
(loop (progn
(princ '-READ---)
(setq *in* (append (read) (list *terminator*)))
(terpri) (princ 'IN---) (princ *in*) (princ " ") (princ (length *in*))
(terpri)
(cond ((null (cdr *in*)) (progn (print 'NOTRETURNING) (return '()))))
(setq *lastknowledge*
(tkl *lastknowlen* (append *lastknowledge* *in*)))
(setq *topics* (tpx (rnl *lastknowledge*) *knowledge*))
(setq *out* (creep-continuations (tkl *seclen* *lastknowledge*)
*knowledge*))
(cond ((and (null (cddr *out*)) (null (car *out*))) (setq *out* '()))
(t (setq *out* (append (rnl *out*)
(list *terminator*)
'()))))
(setq *knowledge*
(append (ncr (length (append *in* *out*))
*knowledge*)
*in* *out*))
(lpr (rnl (cons 'REPLY-- (apply-instincts *out*)))))))
and indeed, I got the following output:
27669> (run)
-READ---()
IN---(trm) 1
NOTRETURNING (REPLY--)
-READ---
So it DOES evaluate the cond-branch correctly, but fails to return.