 (defn add-primitive-entry [dst [names properties]]
   (reduce
    (fn [dst name]
-     (assoc dst name properties))
+     (assoc 
+      dst name 
+      (assoc properties :priority 
+             (count dst))))
    dst
    names))
 

  ([x] (ad x {}))
  ([x derivative-map] (ad-sub x derivative-map)))

(defn ad? [x]
  (= (:type x) :ad))

                              {:scalar? true}))

(def primitive-list [[[:bool] primitive-traits]
                     [[:int32 :int] primitive-number-traits]
                     [[:int64 :long] primitive-number-traits]
                     [[:float :float32] primitive-number-traits]
                     [[:float64 :double] primitive-number-traits]])

(defn scalar? [x]
  (:scalar? x))
