subset()
Verify that one PSL list is a subset of another.
Syntax
Parameter
Parameter | Definition |
---|---|
set | PSL list that is the set in the set-subset verification |
subset | PSL list that is the subset in the set-subset verification |
Description
The subset() function returns a Boolean value of 0 or 1 indicating whether subset is a proper or improper subset of set. Ifsubset is the NULL set, the subset() function returns 1 (TRUE). If set is the NULL set and subset is not, the subset() function returns 0 (FALSE).
The subset() function ignores duplicates and returns 1 only if all elements of subset are also present in set.
Example
The subset() function can be used to determine whether a particular element is present in a set and thus provides "is_member" functionality such as the following:
sub = ["green", "blue"];
if(subset(my_set,"blue"))
{
print("This is a subset");
}
if(subset(my_set,sub))
{
print("This is a subset also");
}
It is not necessary to place a new line at the end of the "blue" string because it is inserted by the subset() function. The example statements are treated as a subset() function acting on a set with one element.