You're viewing version 1.2.0 of subset?. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16

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? set2 set1)))
Vars in clojure.set/subset?: <= and count defn every?
Used in 0 other vars

Comments top

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