-
-
Save amalloy/3d5d85f19505295c9a32 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro counted-meta [& defns] | |
(cons 'do | |
(for [[i [name & body]] (map-indexed vector defns)] | |
`(defn ~(vary-meta name assoc :count i) ~@body)))) | |
user> (counted-meta (f [] 10) (^{:private true} bar [x] (inc x))) | |
#'user/bar | |
user> (meta #'bar) | |
{:ns #<Namespace user>, :name bar, :file "NO_SOURCE_FILE", :line 1, :arglists ([x]), :count 1, :private true} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment