You're viewing version 1.2.0 of select-keys. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16

select-keys

clojure.core

  • (select-keys map keyseq)
Returns a map containing only those entries in map whose key is in keys

1 Example top

  • user=> (select-keys {:a 1 :b 2} [:a])
    {:a 1}
    user=> (select-keys {:a 1 :b 2} [:a :c])
    {:a 1}
    
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:1197 top

(defn select-keys
  "Returns a map containing only those entries in map whose key is in keys"
  {:added "1.0"}
  [map keyseq]
    (loop [ret {} keys (seq keyseq)]
      (if keys
        (let [entry (. clojure.lang.RT (find map (first keys)))]
          (recur
           (if entry
             (conj ret entry)
             ret)
           (next keys)))
        ret)))
Vars in clojure.core/select-keys: conj defn keys let loop next

Comments top

No comments for select-keys. Log in to add a comment.