Clojure – superset?

Clojure superset?

In this guide, we will discuss Clojure superset? Is set1 a superset of set2?

Syntax

Following is the syntax.

(superset? set1 set2)

Parameters − ‘set1’ is the first set of elements. ‘set2’ is the second set of elements.

Return Value − True if set1 is a superset of set2, else false if not.

Example

Following is an example of superset? in Clojure.

(ns clojure.examples.example
   (:require [clojure.set :as set])
   (:gen-class))
(defn example []
   (println (set/superset? #{1 2} #{1 2 3}))
   (println (set/superset? #{1 2 3} #{1 2})))
(example)

Output

The above code produces the following output.

false
true

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply