aboutsummaryrefslogtreecommitdiff
path: root/src/clojure/contrib/core.clj
diff options
context:
space:
mode:
Diffstat (limited to 'src/clojure/contrib/core.clj')
-rw-r--r--src/clojure/contrib/core.clj11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/clojure/contrib/core.clj b/src/clojure/contrib/core.clj
index 0397918b..fe6f50e9 100644
--- a/src/clojure/contrib/core.clj
+++ b/src/clojure/contrib/core.clj
@@ -67,4 +67,15 @@
(clojure.lang.RT/classForName class-name)
(into-array Object args)))
+(defn seqable?
+ "Returns true if (seq x) will succeed, false otherwise."
+ [x]
+ (or (seq? x)
+ (instance? clojure.lang.Seqable x)
+ (nil? x)
+ (instance? Iterable x)
+ (-> x .getClass .isArray)
+ (string? x)
+ (instance? java.util.Map x)))
+
;; ----------------------------------------------------------------------