Make defhelper work.
This commit is contained in:
parent
ec03b7c06f
commit
f9546af9ca
1 changed files with 14 additions and 12 deletions
|
|
@ -18,18 +18,20 @@
|
||||||
(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)
|
||||||
(doto (defn ~helper [& args#]
|
(defn ~helper [& args#]
|
||||||
(let [[m# args#] (if (plain-map? (first args#))
|
(let [[m# args#] (if (plain-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__])
|
;; maintain the original arglist instead of getting
|
||||||
(alter-meta!
|
;; ([& args__6880__auto__])
|
||||||
assoc
|
(alter-meta!
|
||||||
:arglists
|
(var ~helper)
|
||||||
'(~(into [] (rest arglist))
|
assoc
|
||||||
~(into [(first arglist)] (rest arglist)))))))))
|
:arglists
|
||||||
|
'(~(into [] (rest arglist))
|
||||||
|
~(into [(first arglist)] (rest arglist))))))))
|
||||||
|
|
||||||
(defn collify [x]
|
(defn collify [x]
|
||||||
(if (coll? x) x [x]))
|
(if (coll? x) x [x]))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue