how to convert a string to a clojure expression? -
i'd send clojure expression in string evaluated @ receiver, might web service written in compojure. example, suppose have string "(* 7 6)", i'd turn '(* 7 6), can pass eval , 42. operation trivial in javascript, not quite sure how in clojure. hints?
this should trick:
(eval (read-string "(* 7 6)")) ;; 42
or, short:
(load-string "(* 7 6)") ;; 42
Comments
Post a Comment