   ([x] (ad x {}))
   ([x derivative-map] (ad-sub x derivative-map)))
 
-(defn ad? [x]
-  (= (:type x) :ad))
+(defn is-type? 
+  ([x t]
+   (if (map? x)
+     (= t (:type x))))
+  ([t] #(is-type? % t)))
+
+(def ad? (is-type? :ad))
+
+

                              {:scalar? true}))

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

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

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

