;; wouldn't it be nice if... (def-type-multis DataRow (get-column-names [this]) (get-value [this column-name])) (defmethods DataRow clojure.lang.Associative (get-column-names [this] (range (count this))) (get-value [this column-name] (nth this column-name))) ;; so make it happen... (defn type* [obj & _] (type obj)) (defmacro def-type-multis [name & methods] `(do ~@(for [[method-name] methods] `(defmulti ~method-name type*)))) (defmacro defmethods [name dispatch-value & methods] `(do ~@(for [[method-name & more] methods] `(defmethod ~method-name ~dispatch-value ~more))))