How can I add imports to an "eval"ed piece of clojure code?
- by Zubair
I would like to evaluate some clojure code entered by users interactively, and I would like to "use" certain namespaces and "import" certain Java classes as well. I end up running the code using:
(defn execute-command [string-command]
let [
code-with-context (add-code-context string-command)
result (eval(read-string code-with-context))
]
result
)
My question is how can I program "add-code-context" to add the required context to the code in "string-command"?