I was practicing writing macros and I can't seem to get defn
to work.
My syntax is: (my-define name parameter body)
Ignoring & parameters and recursive routines, How do I bind the name to a (fn[parameter] body)?
I was practicing writing macros and I can't seem to get defn
to work.
My syntax is: (my-define name parameter body)
Ignoring & parameters and recursive routines, How do I bind the name to a (fn[parameter] body)?
You will need to transform
(my-define <name> <args> <body>)
to
(def <name> (fn <args> <body>))
This is quite simple actually:
(defmacro my-define [name args body]
`(def ~name (fn ~args ~body)))