public
Last active

  • Download Gist
gistfile1.clj
Clojure
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
(defn unresolvable-syms [form]
(let [usyms (atom #{})
_ (postwalk
#(do
(when (and (symbol? %) (nil? (resolve %)))
(swap! usyms conj %))
%) form)]
@usyms))
 
(defmacro exk [& args]
"[name? doc? attr-map? prepost-map? body]"
(let [{:keys [body] :as fn-decl} (args->fn-decl args)
_ (when-not (nil? (:args fn-decl))
(throw (Throwable. "exk takes no args.")))
(fnk*
(fn-decl->fnk-decl
(assoc fn-decl :args (vec (unresolvable-syms body)))))))

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.