Minor inconsistency in 'some docstring

0 views
Skip to first unread message

Daniel Werner

unread,
Nov 11, 2009, 8:19:11 AM11/11/09
to Clojure
(doc some) says:

"... this will return true if :fred is in the sequence, otherwise nil:
(some #{:fred} coll)"

However, some returns the matching value instead:

=> (some #{:fred} [:foo :fred :ethel])
:fred

Attached patch fixes the docstring. (Not that applying the patch would
be any easier than fixing it by hand :-)

diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj
index d20e10a..9c07409 100644
--- a/src/clj/clojure/core.clj
+++ b/src/clj/clojure/core.clj
@@ -1717,7 +1717,7 @@
(defn some
"Returns the first logical true value of (pred x) for any x in
coll,
else nil. One common idiom is to use a set as pred, for example
- this will return true if :fred is in the sequence, otherwise nil:
+ this will return :fred if :fred is in the sequence, otherwise nil:
(some #{:fred} coll)"
[pred coll]
(when (seq coll)
Reply all
Reply to author
Forward
0 new messages