           bindings))
 
 ;; This is so we can link clauses to the outside world.
+;; Note that we sort the variable list to achieve consistent ordering between
+;; Clojure and ClojureScript, yielding sane tests.
 (defn- impose-external-bindings [cc]
   (if (empty? (:external-bindings cc))
     cc

              (assert external)
              (assert internal)
              [:= external internal]))
          vars)))))

(defn expand-where-from-bindings
  "Take the bindings in the CC and contribute

  (impose-external-bindings
    (assoc cc :wheres
           ;; Note that the order of clauses here means that cross-pattern var bindings
           ;; come last. That's OK: the SQL engine considers these altogether.
           (concat (:wheres cc)
                   (bindings->where (:bindings cc))))))

