diff options
Diffstat (limited to 'src/boot.clj')
-rw-r--r-- | src/boot.clj | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/boot.clj b/src/boot.clj index f27b7c0d..98d78c88 100644 --- a/src/boot.clj +++ b/src/boot.clj @@ -2416,3 +2416,14 @@ not-every? (comp not every?)) (when (seq coll) (lazy-cons (take n coll) (partition n step (drop step coll))))))) +(defmacro definline + "Experimental - like defmacro, except defines a named function whose + body is the expansion, calls to which may be expanded inline as if + it were a macro" + [name & decl] + (let [[args expr] (drop-while (comp not vector?) decl) + inline (eval (list 'fn args expr))] + `(do + (defn ~name ~args ~(apply inline args)) + (let [v# (var ~name)] + (.setMeta v# (assoc ^v# :inline ~inline)))))) |