clojurescript's cljs.reader/read-string expects the input string in edn 
format

(doc cljs.reader/read-string)
=>
-------------------------
cljs.reader/read-string
([s] [opts s])
  Reads one object from the string s.
   Returns nil when s is nil or empty.

   Reads data in the edn format (subset of Clojure data):
   http://edn-format.org

   opts is a map as per cljs.tools.reader.edn/read


the cljs.reader/read-string equivalent in clojure is in clojure.edn 
namespace. 
clojure.edn/read-string returns the same output

(clojure.edn/read-string "'(foo 42)")
=> '

(cljs.reader/read-string "'(foo 42)")
=> '

the top level structure beginning with ' is not specified in edn format, so 
maybe that's why the result is kinda weird.

Yours,
Avi

On Friday, 18 August 2017 04:21:59 UTC+7, [email protected] wrote:
>
> I'm new to ClojureScript, but I didn't find this difference from Clojure 
> noted anywhere. Is this expected?
>
> In Clojure (expected):
>
> (clojure.core/read-string "'(foo 42)")
> => (quote (foo 42))
>
> In ClojureScript:
>
> (cljs.reader/read-string "'(foo 42)")
> => '
>
> If I do the long form quote it works fine:
>
> (cljs.reader/read-string "(quote (foo 42))")
> => (quote (foo 42))
>
> But it appears that it's just reading the quote as a symbol in cljs:
>
> (type (cljs.reader/read-string "'(foo 42)"))
> => cljs.core/Symbol
>
> Thanks,
> Matt
>
>

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/clojurescript.

Reply via email to