diff --git a/src/clj/cljs/compiler.clj b/src/clj/cljs/compiler.clj index 01f23ce8fe..26dd5e64cc 100644 --- a/src/clj/cljs/compiler.clj +++ b/src/clj/cljs/compiler.clj @@ -421,7 +421,7 @@ (defn safe-test? [e] (let [tag (infer-tag e)] - (or (= tag 'boolean) + (or (#{'boolean 'seq} tag) (when (= (:op e) :constant) (let [form (:form e)] (not (or (and (string? form) (= form "")) diff --git a/src/cljs/cljs/core.cljs b/src/cljs/cljs/core.cljs index 5621ad5d2d..5119222566 100644 --- a/src/cljs/cljs/core.cljs +++ b/src/cljs/cljs/core.cljs @@ -570,12 +570,12 @@ reduces them without incurring seq initialization" IHash (-hash [coll] (hash-coll coll))) -(defn seq +(defn ^seq seq "Returns a seq on the collection. If the collection is empty, returns nil. (seq nil) returns nil. seq also works on Strings." [coll] - (if-not (nil? coll) + (when-not (nil? coll) (if (satisfies? ASeq coll) coll (-seq coll)))) @@ -591,7 +591,7 @@ reduces them without incurring seq initialization" (when-not (nil? s) (-first s)))))) -(defn rest +(defn ^seq rest "Returns a possibly empty seq of the items after the first. Calls seq on its argument." [coll] @@ -604,7 +604,7 @@ reduces them without incurring seq initialization" ()))) ())) -(defn next +(defn ^seq next "Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil" [coll]