Make defhelper work.

This commit is contained in:
Richard Newman 2016-07-11 11:00:49 -07:00
parent ec03b7c06f
commit f9546af9ca

View file

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