anchor.diff:  		(subseq sorted 0 beam-width))))
    		)
   
  -		
  -(defun beam-search (problema beam-width) 
  +(defun is-better-solution (heur)
  +      #'(lambda (best-solution-so-far new-solution)
  +	    (> (funcall heur (first new-solution)) (funcall heur (first best-solution-so-far)))))
  +	    
  +(defun beam-search (problema beam-width max-beam-width) 
     (let* ((*nos-gerados* 0)
   		 (*nos-expandidos* 0)
   		 (tempo-inicio (get-internal-run-time))
  
positive.code: ;;;;;;;;;;;;;;;
  ; Beam Search
  ;;;;;;;;;;;;;;;
  
  
  ;thanks to Norvig
  (defun sorter (heur)
    "Return a combiner function that sorts according to heuristic."
    #'(lambda (new old)
        (let* ((all-states (append new old)))
  	(stable-sort all-states #'< :key heur))))
  
  ;Also thanks to Norvig
  (defun beam-sorter (beam-width heur)
         #'(lambda (old new)
  	  (let ((sorted (funcall (sorter heur) old new)))
  
negative.code:                        (if(equal num-elem 0)
                             nil
                           (lanca-sonda (nth (random num-elem) sucessores))))))))
               (loop while (null result) do
                 (setf result (lanca-sonda (problema-estado-inicial problema))))
               (return-from sondagem-iterativa solucao))))
  