Really odd problem in a :children-function
Hello all,
I'm trying to use a graph-pane to display the results of some
tree code that's really more of a demonstration than anything else.
The problem I'm running into is really odd though.
Inside of a (make-instance 'capi:graph-pane ...) I have the following:
:children-function #'(lambda (i)
(unless (isLeaf? i)
(let* ((l (kdtreenode-left i))
(r (kdtreenode-right i))
(c (cond
((and l r) (print "case 1")(list r l))
(l (print "case 2")(list l))
(r (print "case 3")(list r))
(t (print "case 4")()))))
(prog1 c
(unless (every #'identity c)
(format t "~&c is ~A~%" c))))))
A good portion of that code I've added trying to track down this
bug. The problem I get is that c ends up being, at one point,
a list of nil and and good value, i.e.
(nil #s(kdtreenode ...))
My output buffer does indeed have
"case 1"
"case 1"
"case 1"
"case 1"
"case 1"
"case 1"
c is (Nil #S(Kdtreenode ...))
which indicates to me that something strange is going on inside of that
cond. I really hope I've just been staring at this for too long, and that i'm
missing some very obvious that I would normally see. Unforunately, I can't
seem to reproduce it outside of the code I've got (which I can provide if
anyone would like to try).
Any thoughts?
--
=====================
Joshua Taylor
tayloj@rpi.edu