aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscgilardi <scgilardi@gmail.com>2008-08-06 16:21:24 +0000
committerscgilardi <scgilardi@gmail.com>2008-08-06 16:21:24 +0000
commitcbc4590d078ca365e55c4c67ae8c03fb5c223787 (patch)
treed836b84659df1ea14f48844df7c9f7722678b9bf
parent097921e26b0537e148613928e4326823e12b4290 (diff)
lib.clj make using prefixes in use, require, load-namespace a pure convenience with no less or more capability than listing each individual nsspec
-rw-r--r--lib/lib.clj20
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/lib.clj b/lib/lib.clj
index 36c5a94e..daa61ea3 100644
--- a/lib/lib.clj
+++ b/lib/lib.clj
@@ -360,13 +360,19 @@
flags (filter keyword? args)
flag-opts (interleave flags (repeat true))]
(doseq nsarg nsargs
- (if (symbol? nsarg)
- (apply load-lib nil nsarg flag-opts)
- (let [[prefix & nsspecs] nsarg]
- (doseq nsspec nsspecs
- (if (symbol? nsspec)
- (apply load-lib prefix nsspec flag-opts)
- (apply load-lib prefix (concat nsspec flag-opts)))))))))
+ (cond (symbol? nsarg)
+ (apply load-lib nil nsarg flag-opts)
+ (nil? (second nsarg))
+ (apply load-lib nil (first nsarg) flag-opts)
+ (keyword? (second nsarg))
+ (apply load-lib nil (concat nsarg flag-opts))
+ :else
+ (let [[prefix & nsspecs] nsarg]
+ (throw-if (not prefix) "prefix cannot be nil")
+ (doseq nsspec nsspecs
+ (if (symbol? nsspec)
+ (apply load-lib prefix nsspec flag-opts)
+ (apply load-lib prefix (concat nsspec flag-opts)))))))))
(defn namespaces
"Returns a sorted set of symbols naming loaded namespaces"