 		   expected
 		   (better-of candidate best-so-far)
 		   starting-candidate)))))
-
-
-;; (defmethod seq-comparison #{}
-;;   [actual expected & kind]
-;;   (let [starting-candidate  {:actual-found [], :expected-found [], :expected expected }]
-;;     ;; (println "=============")
-;;     ;; (println actual expected)
-    
-;;     (loop [actual           actual
-;; 	   walking-actual   actual
-;;            walking-expected expected
-;;            best-so-far      starting-candidate
-;;            candidate        starting-candidate]
-;;       ;; (println "walking " walking-actual "of" walking-expected)
-
-;;       (cond (or (empty? walking-actual) (empty? walking-expected))
-;;             (better-of candidate best-so-far)
-
-;; 	    (extended-= (first walking-actual) (first walking-expected))
-;; 	    ;; actual good so far, keep working on it
-;; 	    (recur actual
-;; 	           (rest walking-actual)
-;; 		   (rest walking-expected)
-;; 		   best-so-far
-;; 		   (tack-on-to candidate
-;; 			       :actual-found (first walking-actual)
-;; 			       :expected-found (first walking-expected)))
-
-;; 	    (not (empty? actual))
-;; 	    ;; See if we can find something better later on.
-;; 	    (recur (rest actual)
-;; 		   (rest actual)
-;; 		   expected
-;; 		   (better-of candidate best-so-far)
-;; 		   starting-candidate)))))
-
 
 ; Searches through particular types of actual results
 

  [actual expected & kind]
  (let [starting-candidate  {:actual-found [], :expected-found [],
			     :expected-skipped-over [], :expected expected }
	starting-expected-variants (all-expected-variants expected)
	gaps-ok? (some #{:gaps-ok} kind)]
    (println :in-any-order gaps-ok?)
    (loop [walking-actual   actual
	   walking-expected (first starting-expected-variants)
	   expected-variants starting-expected-variants
	   best-so-far      starting-candidate
	   candidate        starting-candidate]


	    ;; window good so far, keep working on it
	    (recur (rest walking-actual)
		   (concat (:expected-skipped-over candidate) (rest walking-expected))
		   expected-permutations
		   best-so-far
		   (tack-on-to candidate
			       :actual-found (first walking-actual)
			       :expected-found (first walking-expected)))

	    (not (empty? (rest walking-expected)))
	    ;; Perhaps another value in the current expected permutation will work.
	    ;; We can, after all, be in any order.
	    (recur walking-actual
		   (rest walking-expected)
		   expected-permutations
		   best-so-far
		   (tack-on-to candidate
			       :expected-skipped-over (first walking-expected)))

	    (not (empty? (rest walking-actual)))
	    ;; OK, there's no match for this actual element in the whole expected.
	    (if gaps-ok?
	      ;; Since gaps are OK, we can drop the bad actual element and look for next one.
	      (recur (rest walking-actual)
		     (first expected-permutations)
		     expected-permutations
		     (better-of candidate best-so-far)
		     candidate)

	      ;; Start again with a new actual: the tail of what we started with.
	      (recur (rest (concat (:actual-found candidate) walking-actual))
		   (first expected-permutations)
		   expected-permutations
		   (better-of candidate best-so-far)
                   starting-candidate))
	    
	    (not (empty? (rest expected-permutations)))
	    ;; No more actual elements, and we still have no match. So try a
	    ;; different permutation of the expected list. (This is required
	    ;; because of matching functions.
            (recur actual
                   (second expected-permutations)
		   (rest expected-permutations)
		   (better-of candidate best-so-far)
                   starting-candidate)

	    :else ; no permutation left, no smaller actuals to try. give up.
	    (better-of candidate best-so-far)))))

(defmethod seq-comparison :strict-order
  [actual expected & kind]
