PING
0.9
Statistical data handling and processing in production environment
|
Calculate the intersection (list of common items) between two unformatted lists of char.
list1, list2
: two lists of unformatted strings;casense
: (option) boolean flag (yes/no
) set to perform cases sensitive comparison/matching; default: casense=no
, i.e. upper-case "intersection" items in both lists are matched;unique
: (option) boolean flag (yes/no
) set in combination with casense=no
so as to return unique values from the input lists, independently of the case; in practice when unique=no
, when two items present in the input lists with distinct (lower- and upper-) cases match through their upper-case versions (i.e., casense=no
), both will be kept in the intersection list; default: unique=yes
;sep
: (option) character/string used as a separator in the input lists; default: sep=%quote( )
, i.e. the input list1
and list2
are both blank-separated lists of items.isec
: output list of strings, namely the list of items obtained as the intersection list1 /\ list2
, i.e. items common to both lists are preserved.
We first show some simple examples of use:
returns: isec1=A B C
, while:
returns a different: isec2=C A B
. Then, also note the use of case sensitiveness:
returns: isec1=C A
. As for the use of the flag unique
, note that:
return: isec2=a B C
and isec3=a B C A b
respectively, while:
return: isec4=C A b
and isec5=C A b a B
respectively.
Run macro %_example_list_difference
for more examples.
list1
and list2
, will be ordered in isec
according to their order of appearance in the first list list1
. For that reason, isec1
and isec2
above differ; still, it can be checked that: will return res=0
, hence the sets supported by isec1
and isec2
are identical. Similarly, in the last example above:
will return res=0
as well (only the order of the elements in the intersection lists differs).
list1
and list2
are reported only once in the output intersection isec
. For that reason, the item A
in the first example above appears only once in isec1
and isec2
. Items present multiple times with both lower- and upper-cases in the input lists will be reported only once in the output list iif unique=yes
and casense=yes
.unique
is ignored when casense=no
.%list_difference, %list_compare, %list_append, %list_find, %list_unique, FINDW.