On Tue, Feb 10, 2009 at 12:02 PM, Craig Andera <[email protected]> wrote:
>
> 3) To ask specifically why clojure.contrib.repl-utils.get-source fails
> so often. I can't figure out why so many of the members fail to
> display the source, when some of the others do, sometimes even in the
> same namespace.
I see that "show source" links are missing on your page for some
functions -- does this indicate a failure of repl-utils/get-source?
These seem to work fine for me:
user=> (use 'clojure.contrib.duck-streams)
nil
user=> (source writer)
(defmulti #^{:tag PrintWriter
:doc "Attempts to coerce its argument into an open
java.io.PrintWriter
wrapped around a java.io.BufferedWriter. Argument may be an
instance of Writer, PrintWriter, BufferedWriter, OutputStream, File,
URI, URL, or String.
If argument is a String, it tries to resolve it first as a URI, then
as a local file name. URIs with a 'file' protocol are converted to
local file names.
Should be used inside with-open to ensure the Writer is properly
closed."}
writer class)
nil
user=> (source slurp*)
(defn slurp*
"Like clojure.core/slurp but opens f with reader."
[f]
(with-open [#^BufferedReader r (reader f)]
(let [sb (StringBuilder.)]
(loop [c (.read r)]
(if (neg? c)
(str sb)
(do (.append sb (char c))
(recur (.read r))))))))
nil
--Chouser
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---