Re: (slurp nil)

2015-06-03 Thread Elric Erkose
@gary Agreed, bad idea. -- 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 gr

Re: (slurp nil)

2015-06-03 Thread Gary Trakhman
This is a bad idea, but you can extend IOFactory to nil within your own programs: https://github.com/clojure/clojure/blob/master/src/clj/clojure/java/io.clj#L182 to return your nullreader. On Wed, Jun 3, 2015 at 3:28 PM Elric Erkose wrote: > @tassilo Your concern could be addressed with a NullRe

Re: (slurp nil)

2015-06-03 Thread Elric Erkose
@tassilo Your concern could be addressed with a NullReader user=> (defn NullReader [] (proxy [java.io.Reader] [] (close [] nil) (read [a b c] -1))) #'user/NullReader user=> (slurp (NullReader)) "" However, this does not resolve my question because "" is not nil. Ev

Re: (slurp nil)

2015-06-02 Thread Tassilo Horn
Elric Erkose writes: Hi Elric, > Is it reasonable that ```(slurp nil)``` throws an Exception rather > than evaluates to nil? Yes, totally. The first argument is something from which a reader can be created, e.g., a java.io.File, a file name as String, an URL, an InputStream, etc. So

Re: (slurp nil)

2015-06-02 Thread Sean Corfield
On Jun 2, 2015, at 2:13 PM, Elric Erkose wrote: > Is it reasonable that ```(slurp nil)``` throws an Exception rather than > evaluates to nil? IMO, yes, throwing an exception is the right thing here, otherwise you’d have nil instead of a string and you’d likely be doing string operations

(slurp nil)

2015-06-02 Thread Elric Erkose
Is it reasonable that ```(slurp nil)``` throws an Exception rather than evaluates to nil? ``` user=> (slurp nil) IllegalArgumentException No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil clojure.core/-cache-protocol-fn (core_def