setintersection function reference
This topic provides reference information about the setintersection
function,
which computes the intersection of the specified sets.
Introduction
The setintersection
function takes multiple sets and produces a single set
containing only the elements that all of the given sets have in common.
In other words, setintersection
computes the intersection of the sets.
Refer to Wikipedia's Intersection (set
theory) article
for a mathematical explanantion of set theory intersection.
Syntax
Use the setintersection
function with the following syntax:
Replace sets...
with a comma-delimited list of sets such as ["a","b"], ["a","c","g"]
. The elements of
the different sets do not have to be the same type.
The setintersection
result is an unordered set.
Example use cases
This example passes in sets of strings and returns a set with one element.
This example passes in number sets of different sizes and returns a set with two elements.
This examples pass in sets of different lengths and element types. The result is a set of two string elements.
Related Functions
contains
tests whether a given list or set contains a given element value.setproduct
computes the Cartesian product of multiple sets.setsubtract
computes the relative complement of two setssetunion
computes the union of multiple sets.