anchor.diff:  
   (defstruct fringe
     (key #'identity)
  -  (elements (make-heap))) ; Heap
  +  (elements (make-heap)))
   
   (defun fringe-remove (q)
     (heap-pop (fringe-elements q) (fringe-key q)))
  
positive.code:   (path-cost 0)
    (depth 0))
  
  (defun expand (heuristic successor node fringe)
    (mapcar (lambda (direction-state-cost)
              (let ((direction (aref direction-state-cost 0))
                    (state (aref direction-state-cost 1))
                    (cost (aref direction-state-cost 2))
                    (depth (node-depth node)))
                (make-node :state state
                           :parent node
                           :direction direction
                           :path-cost (+ depth cost)
                           :depth (1+ depth))))
            (remove-if (lambda (temp-triple)
                         (find (aref temp-triple 1) (fringe-elements fringe) :key #'node-state :test #'equal))
                       (funcall successor heuristic (node-state node) (node-direction node)))))
  
  (defun direction-sequence (node)
    (labels ((direction-sequence-iter (node directions)
               (if (null (node-parent node))
  
negative.code:                (swap state i j)))))
          direction))
  
  (defparameter *width* 3)
  
  (defparameter *target* (vector 0 1 2
                                 3 4 5
                                 6 7 8))
  
  (defparameter *start* (vector 5 1 8
                                7 2 3
                                0 6 4))
  
  (defun goalp (node)
    (equalp node *target*))
  
  (defun action (old-state old-direction)
    ;; return a dotted list (state . direction)
    (remove nil
            (mapcar (lambda (direction)
                      (move-blank old-state direction))
                    (remove (case old-direction
                              (UP 'DOWN)
                              (DOWN 'UP)
                              (RIGHT 'LEFT)
                              (LEFT 'RIGHT))
                            '(UP DOWN RIGHT LEFT)))
            :key #'car))
  
  (defun n-puzzle (search heuristic initial-state)
    (funcall search #'action heuristic #'goalp initial-state))
  
  (format t "A*-search~%")
  (time (format t "~A~%" (n-puzzle #'IDA*-search
                                   #'manhattan
                                   *start*)))
  
  (format t "IDA*-search~%")
  (time (format t "~A~%" (n-puzzle #'A*-search
                                   #'manhattan
                                   *start*)))
  