I have a record (defrecord Rec [id])
I work with it like
(def my ( Rec. 2 ))
(println (:id my))
Now I want to replace record def with macro. So that I could write just
(r 2)
(println (:id my))
I wrote macro
(defmacro r [id]
(list 'def 'my (symbol "(") 'Rec. id (symbol ")")))
I checked it with macroexpand
(macroexpand-1 '(r 2)) => (def my ( Rec. 2 ))
But I get RuntimeException: Too many arguments to def
on (r 2)
.