Skip to main content

Sets

A Set is a collection of elements that are unique (i.e. that does not contain duplicates). The only way to create a Set from other types is to use the ipAddressSet function.

The following operations are available on sets.

  • isEmpty(set): Returns a Bool indicating if set contains no elements.
  • A + B: Returns the union of sets A and B.
  • A - B: Returns the differences of the sets A and B, which contains the elements in A that are not in B.
  • intersect(set1, set2): Returns the intersection of set1 and set2.
  • ip in set and ip not in set: Returns a Bool indicating if the IpAddress ip is contained in set. If set evaluates to null, then ip in set terminates with an error. If ip evaluates to null, then ip in set returns false.
  • subnet in set and subnet not in set: Returns a Bool indicating if the set of IpAddresses represented by the IpSubnet subnet is a subset of set. If set evaluates to null, then subnet in set terminates with an error. If subnet evaluates to null, then subnet in set returns false.
  • subset in superset and subset not in superset: Returns a Bool indicating if subset is a subset of superset. If superset evaluates to null, then subset in superset terminates with an error. If subset evaluates to null, then subset in superset returns false.