Creating code on the fly using Clojure eval
https://clojure-diary.gitlab.io/2025/10/25/creating-code-on-the-fly-using-clojure-eval.html
Code ;; defining_functions_on_the_fly.clj (eval (def x 1)) x (def map-vals {:a 10 :b 20 :c 30}) (doseq [[k v] map-vals] (eval (defn ~(symbol k) [] ~v))) (a) (b) © (def planets [“Earth” “Mars” “Venus” “Jupiter”…
You must log in or register to comment.

