On Thursday 22 April 2010 14:17:15 Base wrote:

Hi!

> say i have a string that contains a form:
> 
> "(+ 1 1)"
> 
> I want to actually execute this.  How do you do this?  I thought that
> eval would be able to handle this but apparently am misunderstanding
> what eval does.

`eval' evals a form, so first you have to parse that string.  But that's
exactly what `read-string' does:

,----
| user> (read-string "(+ 1 2)")
| (+ 1 2)
| user> (eval (read-string "(+ 1 2)"))
| 3
`----

Bye,
Tassilo

-- 
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

Reply via email to