Is it possible to customize cljs.reader/read-string
to handle something like "#(f 123)"
?
I tried this:
(cljs.reader/register-tag-parser! \( (fn [x] "test"))
(cljs.reader/read-string "#(f 123")
but get:
Could not find tag parser for (f in ("inst" "uuid" "queue" "js" "(")
Update:
after a little more digging I came across https://github.com/clojure/clojurescript/blob/6ff80dc2f309f961d2e363148b5c0da65ac320f9/src/test/cljs/cljs/pprint_test.cljs#L106 which confirms that this isn't currently possible:
(simple-tests pprint-reader-macro-test
;;I'm not sure this will work without significant work on cljs. Short story, cljs
;;reader only takes valid EDN, so #(* % %) won't work.
;;see http://stackoverflow.com/a/25712675/546321 for more details
#_(with-pprint-dispatch code-dispatch
(write (reader/read-string "(map #(first %) [[1 2 3] [4 5 6] [7]])")
:stream nil))
#_"(map #(first %) [[1 2 3] [4 5 6] [7]])"