                  (list (list word c -1))
                  (map #(conj (list c %) word) posns)))))
          [(tuple word :length (count word))
-          (tuple word :type   :WORD)]
-         )))
-
-;; (word-triples "abccddd")
+          (tuple word :type   :WORD)])))
+
 
 (defn word-collection-triples [coll]
   (r/fold clojure.set/union clojure.set/union

;;        :start-time 1401743282516,
;;        :end-time   1401743282516,
;;        :time-taken 0}

(defn words-excluding-letter [g letter]
  (set (map s (query g nil letter -1))))

(defn words-excluding [g & letters]
  (apply clojure.set/intersection 
    (filter identity
      (map (partial words-excluding-letter g) letters))))

(defn words-with-letter-position [g letter position]
  (set (map s (query g nil letter position))))

(defn all-words [g]
  (mapv s (query g nil :type :WORD)))

(defn random-element [coll]
  (nth coll (rand-int (count coll))))

(defn random-word [g]
  (random-element (all-words g)))

(defn random-words [g n]
  (loop [words #{} all (all-words g)]
    (if (= (count words) n)
      words
      (recur (conj words (random-element all)) all))))




;; (util/run-and-measure-timing

  (r/fold clojure.set/union clojure.set/union
    (mapv word-triples (words-from-file filename))))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Database Management
