(ns MapSet "Elixir MapSet module — set operations backed by maps. In CljElixir: (MapSet/new [1 2 3]), (MapSet/member? s 2), etc. Use #{1 2 3} literal syntax for set creation in CljElixir.") (defn new "Creates a new set, optionally from an enumerable. (MapSet/new) ;=> #{} (MapSet/new [1 2 3]) ;=> #{1 2 3} (MapSet/new [1 2 3] (fn [x] (* x 2))) ;=> #{2 4 6}" ([]) ([enumerable]) ([enumerable transform])) (defn put "Inserts `value` into the set. (MapSet/put #{1 2} 3) ;=> #{1 2 3}" [set value]) (defn delete "Deletes `value` from the set. (MapSet/delete #{1 2 3} 2) ;=> #{1 3}" [set value]) (defn member? "Returns true if `value` is in `set`. (MapSet/member? #{1 2 3} 2) ;=> true" [set value]) (defn size "Returns the number of elements. (MapSet/size #{1 2 3}) ;=> 3" [set]) (defn to-list "Converts the set to a list. (MapSet/to-list #{1 2 3}) ;=> [1 2 3]" [set]) (defn equal? "Returns true if two sets are equal. (MapSet/equal? #{1 2} #{2 1}) ;=> true" [set1 set2]) (defn union "Returns the union of two sets. (MapSet/union #{1 2} #{2 3}) ;=> #{1 2 3}" [set1 set2]) (defn intersection "Returns the intersection of two sets. (MapSet/intersection #{1 2 3} #{2 3 4}) ;=> #{2 3}" [set1 set2]) (defn difference "Returns elements in `set1` not in `set2`. (MapSet/difference #{1 2 3} #{2 3}) ;=> #{1}" [set1 set2]) (defn symmetric-difference "Returns elements in either set but not both. (MapSet/symmetric-difference #{1 2 3} #{2 3 4}) ;=> #{1 4}" [set1 set2]) (defn subset? "Returns true if `set1` is a subset of `set2`. (MapSet/subset? #{1 2} #{1 2 3}) ;=> true" [set1 set2]) (defn disjoint? "Returns true if `set1` and `set2` have no elements in common. (MapSet/disjoint? #{1 2} #{3 4}) ;=> true" [set1 set2]) (defn filter "Returns elements for which `fun` returns truthy. (MapSet/filter #{1 2 3 4} (fn [x] (> x 2))) ;=> #{3 4}" [set fun]) (defn reject "Returns elements for which `fun` returns falsy." [set fun]) (defn map "Maps `fun` over the set, returning a new set." [set fun])