To view the latest 11.3.x version, see PATROL Agent 11.3.02.

intersection()


Return a list containing elements that are common to all specified lists.

Syntax

intersection(list1,list2,[list3,...,listn])

Parameter

Parameter

Definition

list1...listn

two or more PSL lists that are being evaluated for common elements

Description

The intersection() function returns a PSL list containing the elements that appear in all the lists list1...listn. The returned list is not well-defined and will contain duplicates if duplicates were present in all lists in the same number and order. The elements in the list returned by the intersection() function appear in the same order as they were in list1. If any lists are the NULL list, the return value is the NULL list; otherwise all entries in the returned list are terminated by a new-line character.

Example

The following intersection() function call returns the elements that are common to four sets. (The common elements are 7 and 11.)

list1 = [1,2,3,7,11];
list2 = [4,5,6,7,8,9,10,11];
list3 = [7,11,12,13,14,15,16,17];
list4 = [7,11];
print("common elements are:\n",intersection(list1,list2,list3,list4));

 

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*