 ;;; - cr-map is an ordered (descending) map of major versions
 ;;; - revision is an ordered map of creator tag to update value
 
-(def number-desc (comparator (fn [n m] (> n m))))
-
 (defn cr-map
   [id]
-  (-> (sorted-map-by number-desc)
-      (with-meta {:id id})))
-
-(defn cr-map-id [map] (:id (meta map)))
-
-(def first-key ffirst)
-(def first-val (comp second first))
+  (with-meta
+    (sorted-map-by number-desc)
+    {:id id}))
+
+(defn cr-map-id
+  [map]
+  (get (meta map) :id))
 
 (defn cr-major
   [map]

(defn ap [m & ps] (reduce cr-apply m ps))

(deftest test-associtivity
  (def p4 (cr-update bar :b 4))
  (def p5 (with-c "b" (cr-update bar :b 5)))
  (def p6 (with-c "c" (cr-update bar :c 6)))

  (is (= (ap (ap bar p4 p5) p6)
         (ap (ap bar p4) p5 p6))))


;;; Commutative

(deftest test-commutivity
  (def baz (ap bar p4 p5 p6))

  (def p7 (cr-update baz :b 7))
  (def p8 (with-c "b" (cr-delete baz :b)))

  (is (= (ap baz p7 p8)
         (ap baz p8 p7)))

  (is (= (ap foo p8 p7 p6 p5 p4 p3)
         (ap foo p3 p4 p5 p6 p7 p8)
         (ap foo p3 p5 p4 p6 p8 p7)
         (ap (ap foo p5 p3 p4) p8 p6 p7)
         (ap (ap foo p6 p3 p7) p8 p5 p4 p3 p3 p3))))



;;;
;;; - Is tagged with the minor version number, an orderable bit of
;;;   stuff that identifies the writer

(defn cr-update
  [map & kvs]
