I had previously assumed that the clojure repl effectively just did
(eval (read-string input)). That doesn't seem to be the case eg:

user> [do (inc 1)]
CompilerException java.lang.RuntimeException: Unable to resolve
symbol: do in this context, compiling:(NO_SOURCE_PATH:1:1)
user> (eval '[do (inc 1)])
2
nil
user> (load-string "[do (inc 1)]")
2
nil

user> ^{:line 11, :column 20} []
[]
nil
user> (eval ^{:line 11, :column 20} [])
ClassCastException java.lang.Long cannot be cast to java.lang.Integer
clojure.lang.Compiler.eval (Compiler.java:6597)
user> (load-string "^{:line 11, :column 20} []")
ClassCastException java.lang.Long cannot be cast to java.lang.Integer
clojure.lang.Compiler.eval (Compiler.java:6597)

What can I do to eval a string in the same way that the repl does?

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to