I'd like to do this (in REPL or anywhere)
(defn (symbol "print-string") [k] (println k))
and then be able to do
(print-string "lol")
Or, if there is any other way to create defn from custom strings in macroses, could you push me into the right direction please?
(defmacro defn-with-str [string args & body]
`(defn ~(symbol string) ~args ~@body))
(defn-with-str "print-string" [k] (println k))
(print-string "lol")
dnolen's solution works at macro expansion time, Brian Carper's at read-time. Now, here's one for run-time:
(intern *ns* (symbol "a") (fn [k] (println k)))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With