   (vec 
     (for [ letter target-vec ] (guesses-set letter)) ))
 
+(defn complement-char-class
+  "Generate the regex for the complement of a set of characters."
+  [not-chars]
+  (if (< 0 (count not-chars))
+    (str "[^" (str/join not-chars) "]" )
+    "." ))
+
 (defn clue-to-regex
   "Convert a clue string and set of guessed chars into a regex for filtering possible
   matching words."
   [clue-str guessed-chars]
-  (let [not-guessed-chars   (str "[^" (str/join guessed-chars) "]" )
+  (let [not-guessed-class   (complement-char-class guessed-chars)
         patt-str   (str/join
                      (for [clue-ch clue-str]
-                       (if (= clue-ch \-) not-guessed-chars clue-ch) ))
+                       (if (= clue-ch \-) not-guessed-class clue-ch) ))
     ] patt-str ))
 
 (defn do-tests []

  guess letter. "
  [keep-words used-chars]
  (let [
        avail-chars   (set/difference (set all-letters) used-chars)
        char-bits     (zipmap avail-chars (map #(calc-info-bits keep-words %) avail-chars) )
        best-char     (apply max-key char-bits avail-chars ) ]
    best-char ) )

  (assert (= (apply str (vec "abcd"))    "abcd" ))

  ; Test regex stuff
  (assert (= (complement-char-class #{})         "."      ))
  (assert (= (complement-char-class #{\a \b})    "[^ab]"  ))
  (let [words           ["abcd" "xbcd" "xxcd" "xxxd"]
        letters         [\a \b \c \d] 
        guessed-chars   #{\b \s}
        clue-str        "-b--"

        not-char-class  (complement-char-class guessed-chars)
        patt-str        (clue-to-regex clue-str guessed-chars)
    ]
    (assert (= not-char-class  "[^bs]"                 ))
    (assert (= patt-str        "[^bs]b[^bs][^bs]"      ))
    (assert      (re-find (re-pattern patt-str) "abcd" ))
    (assert      (re-find (re-pattern patt-str) "xbcd" ))
    (assert (not (re-find (re-pattern patt-str) "xxcd" )))
    (assert (not (re-find (re-pattern patt-str) "xxxd" )))
    (println)
  )

