subset?

clojure.set

  • (subset? set1 set2)
Is set1 a subset of set2?

1 Example top

  • user> (clojure.set/subset? #{2 3} #{1 2 3 4})
    true
    
    user> (clojure.set/subset? #{2 4} #{1 2 3 4})
    true
    
    user> (clojure.set/subset? #{2 5} #{1 2 3 4})
    false
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/set.clj:142 top

(defn subset? 
  "Is set1 a subset of set2?"
  {:added "1.2",
   :tag Boolean}
  [set1 set2]
  (and (<= (count set1) (count set2))
       (every? #(contains? set2 %) set1)))
Vars in clojure.set/subset?:
Used in 0 other vars

Comments top

No comments for subset?. Log in to add a comment.