File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 30313031(defmacro definline
30323032 " Experimental - like defmacro, except defines a named function whose
30333033 body is the expansion, calls to which may be expanded inline as if
3034- it were a macro. Cannot be used with variadic (&) args."
3034+ it were a macro. Cannot be used with variadic (&) args."
30353035 [name & decl]
3036- (let [[args expr] (drop-while (comp not vector?) decl)
3037- inline (eval (list `fn args expr))]
3036+ (let [[pre-args [args expr]] (split-with (comp not vector?) decl)]
30383037 `(do
3039- (defn ~name ~args ~(apply inline args))
3040- (let [v# (var ~name)]
3041- ( .setMeta v# ( assoc ^v# :inline ~inline)) ))))
3038+ (defn ~name ~@ pre- args ~args ~ (apply ( eval ( list `fn args expr)) args))
3039+ (alter-meta! (var ~name) assoc :inline ( fn ~args ~expr))
3040+ ( var ~name ))))
30423041
30433042(defn empty
30443043 " Returns an empty collection of the same category as coll, or nil"
You can’t perform that action at this time.
0 commit comments