ClojureDocs

Nav

Namespaces

keys

clojure.core

Available since 1.0 (source)
  • (keys map)
Returns a sequence of the map's keys, in the same order as (seq map).
2 Examples
(keys {:keys :and, :some :values})
;;=> (:keys :some)

(keys {})
;;=> nil

(keys nil)
;;=> nil
;; although doc says it only takes a map, this still works:
(keys (filter (fn [[_ v]] (-> v :t)) {:a {:t true} :b {:t false} :c {:t true}}))
;;=> (:a :c)
See Also

Returns a sequence of the map's values, in the same order as (seq map).

Added by boxie

keyval => key val Returns a new hash map with supplied mappings. If any keys are equal, they ar...

Added by boxie

Returns the key of the map entry.

Added by mmwaikar

Returns a map containing only those entries in map whose key is in keys

Added by timgilbert
3 Notes
    By , created 11.4 years ago

    Functions keys and vals return sequences such that

    (= (zipmap (keys m) (vals m)) m)
    
    By , created 9.5 years ago, updated 9.5 years ago

    I noticed that the keys are not always returned in the same order. Usually they are, but not always.

    By , created 7.0 years ago

    Map with 8 or more keys order are unexpected.