File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 873873; ;map stuff
874874
875875(defn contains?
876- " Returns true if key is present, else false."
877- [map key] (. clojure.lang.RT (contains map key)))
876+ " Returns true if key is present in the given collection, otherwise
877+ returns false. Note that for numerically indexed collections like
878+ vectors and Java arrays, this tests if the numeric key is within the
879+ range of indexes. 'contains?' operates constant or logarithmic time;
880+ it will not perform a linear search for a value. See also 'some'."
881+ [coll key] (. clojure.lang.RT (contains coll key)))
878882
879883(defn get
880884 " Returns the value mapped to key, not-found or nil if key not present."
13491353
13501354(defn some
13511355 " Returns the first logical true value of (pred x) for any x in coll,
1352- else nil."
1356+ else nil. One common idiom is to use a set as pred, for example
1357+ this will return true if :fred is in the sequence, otherwise nil:
1358+ (some #{:fred} coll)"
13531359 [pred coll]
13541360 (when (seq coll)
13551361 (or (pred (first coll)) (recur pred (rest coll)))))
You can’t perform that action at this time.
0 commit comments