1.3.0 permalink 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:1433 top

(defn select-keys
  "Returns a map containing only those entries in map whose key is in keys"
  {:added "1.0"
   :static true}
  [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:
Used in 0 other vars

Comments top

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