Clojure - map values

I am trying to get a clojure function to determine if a passed value is a map. For example,

user=> (if-map {:foo 1}) ;Should return true
true 
user=> (if-map "hello") ;Returns false
false

      

Is there a ready-made function?

+3


source to share


1 answer


Yes map?

- built-in function



(map? {:a 1})
=> true

(map? [1])
=> false

      

+6


source







All Articles