<?xml version="1.0"?>
<paste-with-annotations>
  <paste>
    <number>
      <integer>34536</integer>
    </number>
    <user>
      <string>_deepfire</string>
    </user>
    <title>
      <string>NIL or not NIL?</string>
    </title>
    <contents>
      <string>(defun box-intersect (b0 b1)
  (declare (type box b0 b1))
  (let ((lu (v2max (box-o b0) (box-o b1)))
	(rd (v2min (box-o+d b0) (box-o+d b1))))
    (format t &quot;INTERSECT!~%&quot;)
    (when (not (v2minusp-or (v2- rd lu)))
      (let ((r (make-box-pts :lu lu :rd rd)))
	(format t &quot;INTERSECT: ~S~%&quot; r)
	r))))
(declaim (ftype (function (box box) (or nil box)) box-intersect))

(defun vport-render-terrain (vport targetvis)
  (let* ((loc (vport-location vport))
	 (vbox (vport-box vport))
	 (terr (loc-terrain loc))
	 (scale (vport-scale vport))
	 (inters (box-intersect (box-extend-v2 (loc-largest-visdim loc) vbox)
				(make-box :o (v2zero) :d (loc-d loc)))))
    (format t &quot;inters: ~S ~A~%&quot; inters inters)
    (when inters
      (format t &quot;go NONNIL inters: ~S ~A~%&quot; inters inters)
      (do-loc-area (pt inters loc)
	(let ((terrc (aref-v2 terr pt)))
	  (when (and terrc (v2eq (box-o (ent-box terrc)) pt))
	    (visual-blit (v2*i scale (v2- pt (box-o vbox))) (ent-visual terrc) targetvis)))))))


==================== *starndard-output*:
INTERSECT!
inters: NIL NIL
go NONNIL inters: NIL NIL

i.e.: box-intersect returns NIL -- because WHEN in BOX-INTERSECT is not satisfied
i think it also means that this NIL is generated by lisp itself and is guaranteed to be CL:NIL
yet -- WHEN in VPORT-RENDER-TERRAIN thinks that NIL is good and well and is not NIL at all...
</string>
    </contents>
    <universal-time>
      <integer>3377279299</integer>
    </universal-time>
    <channel>
      <string>#lisp</string>
    </channel>
    <colorization-mode>
      <string>Common Lisp</string>
    </colorization-mode>
    <maybe-spam>
      <null/>
    </maybe-spam>
    <is-unicode>
      <null/>
    </is-unicode>
  </paste>
</paste-with-annotations>