I am guessing that we should infer from literal tag vs. tagged element and the behavior described in your edit, that you are referring to readers installed in data_readers.clj
, and not readers for data through (edn/) read
or read-string
.
Since these are reader functions, they are going to behave like macros in that you can conceptually consider the arguments to be quoted and results evaluated as code.
So, you want this
(defrecord MyRecord [f])
(defn my-tag-reader [f] (list ->MyRecord f))
To get the behavior of this
(def my-record (let [foo 1] #my/example-tag #(inc foo)))
((:f my-record)) ;=> 2
When my-tag-reader
is the (namespaced qualified) reader function of #my/example-tag
in the data_readers.clj
map.