Skip to content

Commit

Permalink
Remove some documentation comments from core.clj and put them in READ…
Browse files Browse the repository at this point in the history
…ME.markdown
  • Loading branch information
jafingerhut committed Feb 23, 2011
1 parent 1255fdc commit 4fd3086
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 42 deletions.
19 changes: 13 additions & 6 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,34 @@ A tiny client for the http://clojuredocs.org API

(use 'cd-client.core)

Examples work with strings for the ns and name as well as just a
method. Use 'pr-examples' to pretty-print a list of all examples
for a method.
Examples work with strings for the ns and name, as well as just a
symbol (no quoting needed). The symbol can be of a special form
(e.g. let, try, catch), macros (e.g. for, areduce), or functions. Use
'pr-examples' to pretty-print a list of all examples for a method.

(examples "clojure.core" "map")
(examples map)
(pr-examples map) ; pretty-prints the examples
(pr-examples clojure.string/join)

If you like even shorter names for interactive use:

(defmacro ex [sym] `(pr-examples ~sym))
(ex let)

Search for a method using just the name or a namespace and name.

(search "pmap")
(search "clojure.core" "map")

Comments works just like examples do, with strings, a var and pretty-
printing.
Comments works just like examples do, with strings, a symbol, and
pretty-printing.

(comments "clojure.contrib.json" "read-json")
(comments read-json)
(pr-comments read-json) ; pretty-prints the comments

See-also works with either strings for ns/name or a method var.
See-also works with either strings for ns/name or a symbol.

(see-also "clojure.test" "are")
(see-also are)
Expand Down
36 changes: 0 additions & 36 deletions src/cd_client/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -84,42 +84,6 @@
(println "Taken from" (:url res))))


;; Examples (!) of using pr-examples. These same examples should also
;; work for the macros examples, comments, pr-comments, see-also, and
;; browse-to.

;; (require 'cd-client.core)
;;
;; Let us save ourselves some typing:
;;
;; (defmacro ex [name] `(cd-client.core/pr-examples ~name))
;;
;; Syntax symbols like catch, finally:
;;
;; (ex catch)
;;
;; Special forms like do, if, let, etc.:
;;
;; (ex let)
;;
;; Macros like for, areduce, etc.:
;;
;; (ex for)
;;
;; Plain old functions, of course:
;;
;; (ex map)
;;
;; and in any namespace that clojuredocs has documentation for:
;;
;; (ex clojure.string/replace)
;;
;; And since it uses Clojure's symbol lookup methods, you can use
;; abbreviations just like if you were using the symbols normally:
;;
;; (require '[clojure.string :as str])
;; (ex str/join)

(defmacro pr-examples
"Given an (unquoted) var, fn, macro, special form, or a namespace and name (as strings), pretty-print all the examples for it from clojuredocs"
([name]
Expand Down

0 comments on commit 4fd3086

Please sign in to comment.