Skip to content

Commit

Permalink
* src/clj/cljs/compiler.clj: CLJS-274: type-hint seq, rest, next
Browse files Browse the repository at this point in the history
  • Loading branch information
David Nolen authored and David Nolen committed May 28, 2012
1 parent 0e0aa7f commit af3ec4b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/clj/cljs/compiler.clj
Expand Up @@ -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 ""))
Expand Down
8 changes: 4 additions & 4 deletions src/cljs/cljs/core.cljs
Expand Up @@ -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))))
Expand All @@ -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]
Expand All @@ -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]
Expand Down

0 comments on commit af3ec4b

Please sign in to comment.