Clojure - difference
Return a set that is the first set without elements of the remaining sets.
Syntax
Following is the syntax.
(difference set1 set2)
Parameters − set1 is the first set of elements. set2 is the second set of elements.
Return Value − The difference between the set of elements.
Example
Following is an example of difference in Clojure.
(ns clojure.examples.example
(:require [clojure.set :as set])
(:gen-class))
(defn example []
(println (set/difference #{1 2} #{2 3})))
(example)
Output
The above code produces the following output.
#{1}
clojure_sets.htm
Advertisements