Details
-
Type:
Defect
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Declined
-
Affects Version/s: Release 1.2
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:Mac OS X Java 6
Description
Very minor, but noticed while browsing that "some" is defined as:
(defn some
...
[pred coll]
(when (seq coll)
(or (pred (first coll)) (recur pred (next coll)))))
The "(seq coll)" call will potentially generate an unused seq each time.
The `seq` function is the idiomatic way to ask the question "does this collection have something in it?" and is the correct approach in the case of `some`. If we were to use `seq?` then we would be asking an entirely different question: "does this collection implement the ISeq interface". In the case of using `seq?`, `some` would no longer work against the seq abstraction. It's tempting to look at the name `seq` and `seq?` and assume that they mean similar things. The type-based predicates are tricky.