Merge pull request #21 from gfredericks/arglist-metadata

The defhelper macro should expose the arglist as the standard :arglist metadata
This commit is contained in:
Howard M. Lewis Ship 2014-10-07 18:12:50 -07:00
commit 1157887edd

View file

@ -10,11 +10,14 @@
(let [kw (keyword (name helper))] (let [kw (keyword (name helper))]
`(do `(do
(defmethod build-clause ~kw ~(into ['_] arglist) ~@more) (defmethod build-clause ~kw ~(into ['_] arglist) ~@more)
(defn ~helper [& args#] (doto (defn ~helper [& args#]
(let [[m# args#] (if (map? (first args#)) (let [[m# args#] (if (map? (first args#))
[(first args#) (rest args#)] [(first args#) (rest args#)]
[{} args#])] [{} args#])]
(build-clause ~kw m# args#)))))) (build-clause ~kw m# args#)))
;; maintain the original arglist instead of getting
;; ([& args__6880__auto__])
(alter-meta! assoc :arglists '(~arglist))))))
(defn collify [x] (defn collify [x]
(if (coll? x) x [x])) (if (coll? x) x [x]))