update README.md

This commit is contained in:
Gered 2014-03-25 11:22:16 -04:00
parent 5a040c35df
commit 80afd496ac

View file

@ -42,7 +42,7 @@ on each namespace (as a symbol) found.
; using namespace filtering ; using namespace filtering
(find-vars (find-vars
#(= (:name %) 'find-namespaces) #(= (:name %) 'find-namespaces)
#(not= % 'clj-metasearch.core)) :namespace-pred #(not= % 'clj-metasearch.core))
=> ({:ns clojure.tools.namespace.find, :var (var clojure.tools.namespace.find/find-namespaces)}) => ({:ns clojure.tools.namespace.find, :var (var clojure.tools.namespace.find/find-namespaces)})
``` ```
@ -50,14 +50,16 @@ By default, to help avoid loading a bunch of libraries the first time `find-vars
automatically loaded before being checked. Thusly, you will only be able to find Vars in namespaces that are automatically loaded before being checked. Thusly, you will only be able to find Vars in namespaces that are
currently loaded. currently loaded.
`find-vars` takes a third optional argument that allows you to change this behaviour. Passing `true` as the `find-vars` takes an additional optional argument `:require-all-namespaces?` that allows you to change this
third argument will cause each namespace being checked to first be loaded via `require`. behaviour. Passing `true` will cause each namespace being checked to first be loaded via `require`.
```clojure ```clojure
(find-vars #(= (:name %) 'parse)) (find-vars #(= (:name %) 'parse))
=> () => ()
(find-vars #(= (:name %) 'parse) nil true) (find-vars
#(= (:name %) 'parse)
:require-all-namespaces? true)
=> ({:ns clojure.xml, :var (var clojure.xml/parse)}) => ({:ns clojure.xml, :var (var clojure.xml/parse)})
``` ```