anchor.diff:    (loop for free-rect in free-rects appending (subdivide-rect free-rect rect)))
   
   (defun containsp (outer inner)
  -  (with-rect (x0 y0 w0 h0) outer
  -    (with-rect (x1 y1 w1 h1) inner
  +  (%with-rect (x0 y0 w0 h0) outer
  +    (%with-rect (x1 y1 w1 h1) inner
         (and (>= (+ x0 w0) (+ x1 w1) x1 x0)
              (>= (+ y0 h0) (+ y1 h1) y1 y0)))))
   
  
positive.code: 
  (defun subdivide-rect (rect placed)
    (if (intersectsp placed rect)
        (with-rect (x y w h) rect
          (with-rect (xp yp wp hp) placed
            (let (result)
              ;; left part
              (when (splitsp xp x (+ x w))
  
negative.code:                                                                  free-rects)))))
  
  (defun pack (dimensions &key width height)
    (labels ((largest-side (el)
               (max (second el) (third el)))
             (shortest-side (el)
               (min (second el) (third el)))
             (short-side-last ()
               (sort dimensions #'> :key #'shortest-side))
             (double-sorted-dimensions ()
               (sort (short-side-last) #'> :key #'largest-side)))
  
    (loop with free-rects = (list (list 0 0 width height))
       for (id rect-width rect-height) in (double-sorted-dimensions) collect
         (multiple-value-bind (rect new-free-rects)
             (place-rect rect-width rect-height free-rects)
           (setf free-rects new-free-rects)
           (%with-rect (x y w h) rect
             (list id x y w h))))))
  
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  