On Monday, April 29, 2013 6:07:01 PM UTC-4, Cedric Greevey wrote:
>
>
> If you want to exhaust read-string's input argument, getting back a vector 
> of all of the objects in the input and an error if any of them are 
> syntactically invalid, just call (read-string (str "[" in-string "]")). 
> This also deals with empty inputs in a non-blowing-up manner, returning an 
> empty vector, which might allow uniform handling of the cases (empty? 
> in-string) and (not (empty? in-string)) in some instances.
>
>
Interestingly, my code already contains something like the following:

(let [expr (-> (str "(" input ")") read-string)] ...)

It felt wrong when I wrote this, but it seems like I was in the right 
track? I'm guessing vectors are safer than lists for passing to eval?

 

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