Skip to content
Browse files

Remove some documentation comments from core.clj and put them in READ…

…ME.markdown
  • Loading branch information...
1 parent 1255fdc commit 4fd3086d387fd12fb11b4f46a94fc0ddc7e39e37 @jafingerhut jafingerhut committed
Showing with 13 additions and 42 deletions.
  1. +13 −6 README.markdown
  2. +0 −36 src/cd_client/core.clj
View
19 README.markdown
@@ -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)
View
36 src/cd_client/core.clj
@@ -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]

0 comments on commit 4fd3086

Please sign in to comment.
Something went wrong with that request. Please try again.