Use clojure.edn/read-string.  Note the clojure.edn namespace.  
clojure.core/read-string can execute code (controlled by *read-eval*), and as 
such should be used only with trusted sources.

> On Jan 1, 2017, at 10:07 AM, Yehonathan Sharvit <vie...@gmail.com> wrote:
> 
> I’d like to write a function `foo` that receives a string `s` and returns a 
> list with the value of `s` without the quotes as a single element.
> A possible implementation, I wrote:
> ```
> (defn foo [s]
> (list (symbol s)))
> 
> (def my-string "[1 2]")
> (foo my-string) ; ([1 2])
> ```
> But it feels weird to me to call `symbol` for that purpose. 
> 
> I call also call `read-string`...
> 
> What is the proper way of writing `foo`?

-- 
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/d/optout.

Reply via email to