2014-12-08 8:12 GMT+00:00 Fluid Dynamics <a2093...@trbvm.com>: > On Monday, December 8, 2014 2:26:42 AM UTC-5, Andy Fingerhut wrote: >> >> In regards to your question "Why isn't this documented anywhere?", it is >> documented somewhere -- in the documentation string for clojure.edn/read, >> the very function you were attempting to use: >> >> user=> (doc clojure.edn/read) >> ------------------------- >> clojure.edn/read >> ([] [stream] [opts stream]) >> Reads the next object from stream, which must be an instance of >> java.io.PushbackReader or some derivee. stream defaults to the >> current value of *in*. >> > > What's *not* documented is that io/reader doesn't output something that > edn/read can use directly, nor is there documented an officially > recommended workaround for this. >
FWIW I don't think that io/reader(v1.2) was intended to output something that edn/read can use directly, as it was added well before clojure.edn (v1.5). > AFAICT just wrapping the reader output in "(java.io.PushbackReader. ...)" > works. > There you go. > > Still, this is awkward, verbose, and prevents the (nontrivial) use of edn > in a platform-neutral way by referring only to Clojure functions without > direct interop. Well, except for the even more awkward workaround of slurp > and read-string, with the accompanying need to hold the entire file in > memory *twice* for a short time. > > As far as why it requires a PushbackReader, I didn't design the API. Yes, >> some things in Clojure require using Java interop, and in many (but not >> all) cases, file I/O requires it. >> > > Perhaps io/reader should output a PushbackReader, if only for > convenience's sake. > io/reader is not meant to be used solely as an input to edn/read. > > Also, how does this work on ClojureCLR or ClojureScript? Neither of those > platforms has a java.io.PushbackReader, and I'm not even sure what the > equivalent of the clojure.java.io namespace is for them, unless the > "java" in that name is misleading. > Exactly! There is no clojure.java.io as they are on a different host. Different host implies likely different I/O capabilities. BTW cljs has cljs.reader/read-string > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- László Török -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.