(comparator pred)
Returns an JavaScript compatible comparator based upon pred.
(defn comparator [pred] (fn [x y] (cond (pred x y) -1 (pred y x) 1 :else 0)))