This is still early, but it might be in a form where someone would like to
use it, and I'd appreciate suggestions on what would make it more useful.

It is a fork of the clojuredocs client created by Lee Hinman, with some
additions so that you can either run it in the default "web mode", where it
retrieves results from clojuredocs.org, or you can run it in "local mode",
where it gets results from a snapshot file on your local drive.  The latter
is motivated by off-line use, e.g. you are doing Clojure coding on your
laptop with no Internet access.  Right now this fork is only available via
github:

http://github.com/jafingerhut/cd-client

(use 'cd-client.core)
(doc cdoc)

The help from (doc cdoc) has some examples of use, and gives the name of
the function to switch to local mode.

cdoc currently shows the Clojure doc string, followed by examples,
see-alsos, and comments from clojuredocs.org.  An example of the output for
(cdoc letfn) is appended below, and shouldn't be surprising if you have
used clojuredocs.org before.

Enhancements I'm still planning to make:

+ Currently Clojure 1.2.0 and its contrib libraries are included when doing
searches.  I want to add a way to restrict shown documentation to the
Clojure version being used by the REPL, perhaps with a way to force
showing/searching of documentation for other Clojure versions.

+ Add a way to make cdoc only print a subset of the documentation sources
that it does now, e.g. only the examples, or only the examples and
comments.  There are already functions for printing individual ones of
those, but their names are longer, and perhaps some people might typically
only want to see some of those, not all.

+ Perhaps add other sources of documentation.  Any suggestions there?

+ Bug: A few symbols don't work with the clojuredocs.org API right now, but
only a few (+, /, ., and ..)  That might require changes to the server to
correct.

Andy



Example output:

user=> (cdoc letfn)
-------------------------
clojure.core/letfn
  (letfn [fnspecs*] exprs*)
Special Form
  fnspec ==> (fname [params*] exprs) or (fname ([params*] exprs)+)

  Takes a vector of function specs and a body, and generates a set of
  bindings of functions to their names. All of the names are available
  in all of the definitions of the functions, as well as the body.
========== vvv Examples ================
  user=> (letfn [(twice [x]
                   (* x 2))
                 (six-times [y]
                   (* (twice y) 3))]
           (println "Twice 15 =" (twice 15))
           (println "Six times 15 =" (six-times 15)))
  Twice 15 = 30
  Six times 15 = 90
  nil

  ;; Unable to resolve symbol: twice in this context
  user=> (twice 4)
  ; Evaluation aborted.

  ;; Unable to resolve symbol: six-times in this context
  user=> (six-times 100)
  ; Evaluation aborted.
========== ^^^ Examples ================
1 example found for clojure.core/letfn

========== vvv See also ================
  let
========== ^^^ See also ================
1 see-also found for clojure.core/letfn

========== vvv Comments ================
  Using `letfn` allows you to create local functions that reference each
  other whereas `(let myfunc #(...)]...)` wouldn't because it executes its
  bindings serially.
========== ^^^ Comments ================
1 comment found for clojure.core/letfn
nil
user=>

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

Reply via email to