Skip to content

Instantly share code, notes, and snippets.

@amalloy
Created January 19, 2012 07:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amalloy/1638602 to your computer and use it in GitHub Desktop.
Save amalloy/1638602 to your computer and use it in GitHub Desktop.
(defn read-string-safely [s]
(binding [*read-eval* false]
(with-in-str s
(let [end (Object.)]
(doall (take-while (complement #{end})
(repeatedly #(read *in* false end))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment