diff options
author | scgilardi <scgilardi@gmail.com> | 2009-06-03 19:26:48 +0000 |
---|---|---|
committer | scgilardi <scgilardi@gmail.com> | 2009-06-03 19:26:48 +0000 |
commit | bc07de7c3b1058f4263bd7b1c424f771fb010005 (patch) | |
tree | 3ec455e14a4333da9cc434e2f8b380af9b19623e /src/clojure/contrib/core.clj | |
parent | abf462cb24fddb21834b523e3c56f568443714f8 (diff) |
clojure.contrib.core: add seqable?
Diffstat (limited to 'src/clojure/contrib/core.clj')
-rw-r--r-- | src/clojure/contrib/core.clj | 11 |
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))) + ;; ---------------------------------------------------------------------- |