0

I was trying something like

(let [x 1] (load-string "(str x)"))

But it gave me an error saying:

CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(null:1:1)

I am not able to understand why the load-string function is not able to resolve the x symbol in the let block.

I am able to execute it if I define a symbol x in the global scope, but that is not what I want.

amalloy
  • 89,153
  • 8
  • 140
  • 205
Punit Naik
  • 515
  • 7
  • 26
  • 1
    It makes no sense to use eval like that. Why should it know about your lexical closures? Perhaps you should use `apply` instead? – Sylwester Jul 30 '18 at 01:30
  • I don't know that it makes "no sense". It is not supported by Clojure's evaluation model, but other languages have chosen to support this in their `eval`. – amalloy Jul 31 '18 at 01:20

0 Answers0