 ;;; - A functional update, this returns a new cr-map
 
 (defn cr-apply
-  [map {:keys [val maj min] :as update}]
-  (assoc map
-    maj
-    (assoc (cr-get-rev map maj)
-      min val)))
+  [map update]
+  (let [{val :val maj :maj min :min} update]
+    (assoc map
+      maj
+      (assoc (cr-get-rev map maj)
+        min val))))
 
  

;;; - 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))

(defn cr-major
  [map]

  (:use
   clojure.test))

;;; Not a slide, just some odds and ends

(def number-desc
  (comparator (fn [n m] (> n m))))

(defn first-key [map] (first (first map)))
(defn first-val [map] (second (first map)))

(def ^:dynamic creator-key "a")
(defmacro as-creator
  [c & body]
  `(binding [creator-key ~c]
     ~@body))

(declare cr-map-id cr-major)


;;; The over the wire update format
