Skip to content

Instantly share code, notes, and snippets.

@amalloy
Created January 19, 2012 07:35
Show Gist options
  • Select an option

  • Save amalloy/1638602 to your computer and use it in GitHub Desktop.

Select an option

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