github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/docs/job-specification/hcl2/functions/collection/setintersection.mdx (about) 1 --- 2 layout: docs 3 page_title: setintersection - Functions - Configuration Language 4 sidebar_title: setintersection 5 description: |- 6 The setintersection function takes multiple sets and produces a single set 7 containing only the elements that all of the given sets have in common. 8 --- 9 10 # `setintersection` Function 11 12 The `setintersection` function takes multiple sets and produces a single set 13 containing only the elements that all of the given sets have in common. 14 In other words, it computes the 15 [intersection](<https://en.wikipedia.org/wiki/Intersection_(set_theory)>) of the sets. 16 17 ```hcl 18 setintersection(sets...) 19 ``` 20 21 ## Examples 22 23 ```shell-session 24 > setintersection(["a", "b"], ["b", "c"], ["b", "d"]) 25 [ 26 "b", 27 ] 28 ``` 29 30 The given arguments are converted to sets, so the result is also a set and 31 the ordering of the given elements is not preserved. 32 33 ## Related Functions 34 35 - [`contains`](/docs/job-specification/hcl2/functions/collection/contains) tests whether a given list or set contains 36 a given element value. 37 - [`setproduct`](/docs/job-specification/hcl2/functions/collection/setproduct) computes the _Cartesian product_ of multiple 38 sets. 39 - [`setunion`](/docs/job-specification/hcl2/functions/collection/setunion) computes the _union_ of 40 multiple sets.