# Sets

You can convert a list returned by a plural Inspector into a mathematical set. As such, you can perform typical set operations such as union and intersection. You can create sets from individual elements, separated by semicolons:

``intersection of (set of ("to";"be"); set of ("or";"not";"to";"be"))``

This phrase returns the set composed of the two elements: be and to. Sets cannot be directly represented in the debugger. To see the individual items in the list, use the elements command:

``````Q: elements of intersection of (set of ("to";"be"); set of ("or";"not";
"to";"be"))
A: be
A: to``````

You can also create sets from ordinary lists. Here's an example using session inspectors that must be run in the Presentation Debugger:

``````intersection of administered computer sets of bes users whose (name of it is "joe"
or name of it is "sue")``````

The "intersection" phrase returns the set of computers administered by both Sue and Joe. Similarly, you can compute the union of sets:

``````size of union of applicable computer sets of bes fixlets whose ((source severity
of it is "Critical") and (current date - source release date of it > 7 * day)) as
floating point / size of bes computer set as floating point``````

This expression returns the ratio of computers which have at least one relevant critical Fixlet released more than 1 week ago. Note the use of the word size which returns the number of elements in the set.

Note: The phrases with "bes", such as "bes fixlet" and "bes computer" are session inspectors and will only work in the Presentation Debugger while the Console is in session. Attempting to evaluate these expressions in the Fixlet Debugger will produce an error indicating that the operator is not defined.

Sets also allow subtraction:

``set of (1;2;3;4) – set of (1;5)``

Returns the set composed of the elements 2,3 and 4. Note that subtracting a number not in the original set doesn’t affect the result. You can convert the set back to a printable list, using the elements command.

``````Q: elements of (set of (1;2;3;4) – set of (1;5))
A: 2
A: 3
A: 4``````

The elements keyword iterates over the set object, returning the individual set elements as an ordinary list.