Re: Better/more idiomatic way to read EDNs than using java.io.PushbackReader

2015-03-08 Thread Matthew Boston
I've done something like:

(clojure.edn/read-string (slurp (clojure.java.io/resource edn-file)))

This of course assumes the file resides in `app-root/resources`.

On Friday, March 6, 2015 at 8:18:03 PM UTC-7, Sam Raker wrote:

 I'm experimenting a little with EDN files. I've currently got this 
 function:

 (defn from-edn [edn-file] (with-open [r (clojure.java.io/reader edn-file)]
 (edn/read (java.io.PushbackReader. r

 Having to explicitly reach into the Java API to read a clojure-only format 
 seems wrong. What should I be doing instead?


-- 
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.


Re: Better/more idiomatic way to read EDNs than using java.io.PushbackReader

2015-03-07 Thread Matching Socks
Vote for clojure.java.io/pushback-reader 
http://dev.clojure.org/jira/browse/CLJ-1611 ?

That enhancement suggestion contains links to some previous discussions on 
the subject.



On Friday, March 6, 2015 at 10:18:03 PM UTC-5, Sam Raker wrote:

 I'm experimenting a little with EDN files. I've currently got this 
 function:

 (defn from-edn [edn-file] (with-open [r (clojure.java.io/reader edn-file)]
 (edn/read (java.io.PushbackReader. r

 Having to explicitly reach into the Java API to read a clojure-only format 
 seems wrong. What should I be doing instead?


-- 
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.


Better/more idiomatic way to read EDNs than using java.io.PushbackReader

2015-03-06 Thread Sam Raker
I'm experimenting a little with EDN files. I've currently got this function:

(defn from-edn [edn-file] (with-open [r (clojure.java.io/reader edn-file)]
(edn/read (java.io.PushbackReader. r

Having to explicitly reach into the Java API to read a clojure-only format 
seems wrong. What should I be doing instead?

-- 
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.


Re: Better/more idiomatic way to read EDNs than using java.io.PushbackReader

2015-03-06 Thread Mark Mandel
Totally off the top of my head, but this should work -

(edn/read-string (join   (line-seq r)))

Mark

On 7 March 2015 at 14:18, Sam Raker sam.ra...@gmail.com wrote:

 I'm experimenting a little with EDN files. I've currently got this
 function:

 (defn from-edn [edn-file] (with-open [r (clojure.java.io/reader edn-file)]
 (edn/read (java.io.PushbackReader. r

 Having to explicitly reach into the Java API to read a clojure-only format
 seems wrong. What should I be doing instead?

 --
 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.




-- 
E: mark.man...@gmail.com
T: http://www.twitter.com/neurotic
W: www.compoundtheory.com

2 Devs from Down Under Podcast
http://www.2ddu.com/

-- 
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.