How to check if a map is a subset of another in clojure?

clojure

Solution

Making an assumption on what you mean by subset (direct translation of that definition):

(and (every? (set (keys m1)) (keys m2))  ;; subset on keys
     (every? #(= (m1 %)(m2 %)) (keys m2)))   ;; on that subset all the same values

Problem

I would like to write a function that checks if a map is a subset of another. An example of usage should be: ``` (map-subset? {:a 1 :b 2} {:a 1 :b 2 :c 3}) => true ``` Is there a native way to do that?

Original source