Back

superset? (clj)

(source)

function

(superset? set1 set2)
Is set1 a superset of set2?

Examples

clojure

(ns clojure.test-clojure.clojure-set
  (:use clojure.test)
  (:require [clojure.set :as set]))

(deftest test-superset?
  (are [super sub] (set/superset? super sub)
       #{} #{}
       #{1} #{}
       #{1} #{1}
       #{1 2} #{1 2}
       #{1 2 42} #{1 2}
       #{false}  #{false}
       #{nil}    #{nil}
       #{false nil} #{false}
       #{1 2 4 nil false} #{1 2 nil})
  (are [notsuper sub] (not (set/superset? notsuper sub))
       #{} #{1}
       #{2} #{1}
       #{1} #{1 3}
       #{nil} #{false}
       #{false} #{nil}
       #{nil}   #{false nil}
       #{nil 2 3} #{false nil 2 3}))
clojure/clojure

(ns clojure.test-clojure.clojure-set
  (:use clojure.test)
  (:require [clojure.set :as set]))

(deftest test-superset?
  (are [super sub] (set/superset? super sub)
       #{} #{}
       #{1} #{}
       #{1} #{1}
       #{1 2} #{1 2}
       #{1 2 42} #{1 2}
       #{false}  #{false}
       #{nil}    #{nil}
       #{false nil} #{false}
       #{1 2 4 nil false} #{1 2 nil})
  (are [notsuper sub] (not (set/superset? notsuper sub))
       #{} #{1}
       #{2} #{1}
       #{1} #{1 3}
       #{nil} #{false}
       #{false} #{nil}
       #{nil}   #{false nil}
       #{nil 2 3} #{false nil 2 3}))
clojure/clojurescript
(ns clojure.set-test
  (:require [clojure.test :refer [are deftest is]]
            [clojure.set :as set]))

(deftest test-superset?
  (are [super sub] (set/superset? super sub)
    #{} #{}
    #{1} #{}
    #{1} #{1}
    #{1 2} #{1 2}
    #{1 2 42} #{1 2}
    #{false}  #{false}
    #{nil}    #{nil}
    #{false nil} #{false}
    #{1 2 4 nil false} #{1 2 nil})
  (are [notsuper sub] (not (set/superset? notsuper sub))
    #{} #{1}
    #{2} #{1}
    #{1} #{1 3}
    #{nil} #{false}
    #{false} #{nil}
    #{nil}   #{false nil}
    #{nil 2 3} #{false nil 2 3}))
arcadia-unity/Arcadia

(ns clojure.test-clojure.clojure-set
  (:use clojure.test)
  (:require [clojure.set :as set]))

(deftest test-superset?
  (are [super sub] (set/superset? super sub)
       #{} #{}
       #{1} #{}
       #{1} #{1}
       #{1 2} #{1 2}
       #{1 2 42} #{1 2}
       #{false}  #{false}
       #{nil}    #{nil}
       #{false nil} #{false}
       #{1 2 4 nil false} #{1 2 nil})
  (are [notsuper sub] (not (set/superset? notsuper sub))
       #{} #{1}
       #{2} #{1}
       #{1} #{1 3}
       #{nil} #{false}
       #{false} #{nil}
       #{nil}   #{false nil}
       #{nil 2 3} #{false nil 2 3}))
day8/re-frame-10x
(ns day8.re-frame-10x.panels.traces.events
  (:require
   [clojure.set                                                  :as set]
   [clojure.string                                               :as string]
   [day8.re-frame-10x.inlined-deps.re-frame.v1v3v0.re-frame.core :as rf]
   [day8.re-frame-10x.fx.local-storage                           :as local-storage]))

(rf/reg-event-db
 ::toggle-categories
 [(rf/path [:traces :categories]) rf/trim-v (local-storage/save "categories")]
 (fn [old [new]]
   (if (set/superset? old new)
     (set/difference old new)
     (set/union old new))))
typedclojure/typedclojure
(ns clojure.core.typed.test.set-new
  (:require [typed.clojure :as t]
            [clojure.set :as set] 
            [clojure.test :refer :all]                
            [typed.clj.checker.test-utils :refer :all]))

(deftest superset-test
  (is-tc-e (superset? #{1} #{2}) t/Bool 
           :requires [[clojure.set :refer [superset?]]])
  (is-tc-err (superset? #{1} #{2}) (t/Set t/Any) 
             :requires [[clojure.set :refer [superset?]]]))