function | since v0.0-927 | clojure.core/seq | Edit |
(seq coll)
Returns a sequence on the collection. If the collection is empty, returns nil.
(seq nil)
returns nil.
seq
also works on strings.
Returns a seq on the collection. If the collection is empty, returns nil. (seq nil) returns nil. seq also works on Strings.
(defn ^seq seq
[coll]
(when-not (nil? coll)
(cond
(implements? ISeqable coll)
(-seq coll)
(array? coll)
(when-not (zero? (alength coll))
(IndexedSeq. coll 0 nil))
(string? coll)
(when-not (zero? (.-length coll))
(IndexedSeq. coll 0 nil))
(js-iterable? coll)
(es6-iterator-seq
(.call (gobject/get coll ITER_SYMBOL) coll))
(native-satisfies? ISeqable coll)
(-seq coll)
:else (throw (js/Error. (str coll " is not ISeqable"))))))