PRODUCT
shared stuff
       
Subsystem
list
       
Top
level

List Utilities

Defined in: ../Shared/ListUtils.inc

This file contains utilities for querying and manipulating lists (sets).


Utility Functions

boolean LSTisSubset (list of anytype laListOne, list of anytype laListTwo)
list of anytype LSTgetRespectiveComplement (varargs of list of anytype laLists)
list of anytype LSTgetUnion (varargs of list of anytype laLists)
list of anytype LSTgetSymmetricDifference (varargs of list of anytype laLists)
list of anytype LSTgetIntersection (varargs of list of anytype laLists)


LSTisSubset

Returns whether the first list is a subset of the second list.
(Whether all of the items in the first list are in the second list)

Declaration

boolean LSTisSubset (list of anytype laListOne, list of anytype laListTwo);

Inputs

laListOne
The list to be checked to see if it is a subset of the second list..
laListTwo
The list to check the first list against.

Returns

TRUE if laListOne is a subset of laListTwo, FALSE if not.

Example of Usage

bIsSubset = LSTisSubset({1,2,3}, {0,1,2,3,4});

In this case, bIsSubset would be TRUE because each item in the first list 
is found in the second list.


LSTgetRespectiveComplement

Returns items unique to the first list. Otherwise known as 'The complement of B with respect to A', but, in this case, it can handle more than two lists.
For example: A-B or A-(B+C+D+...)
NOTE: any duplicate items are discarded (only listed once).

Declaration

list of anytype LSTgetRespectiveComplement (varargs of list of anytype laLists);

Inputs

laLists
A list containing two or more lists to be used to determine the Respective Complement.
NOTE: Make sure the first list is the list for which you want to get the unique items.

Returns

The list of items that make up the Respective Complement.
NOTE: any duplicate items are discarded (only listed once).

Example of Usage

An example of A-B:

lsComplement = LSTgetRespectiveComplement({"a","b","c","d","e","f","g","h","i","j"}, 
                                                     {"c","d","e","f","z"});
                                                     
	//lsComplement would be {"a","b","g","h","i","j"}.


An example of A-(B+C)

lsComplement = LSTgetRespectiveComplement({"a","b","c","d","e","f","g","h","i","j"}, 
                                                 {"c","d","e","f","z"}, {"i","j","k"});
                                                 
	//lsComplement would be {"a","b","g","h"}.


LSTgetUnion

Returns the Union of the supplied lists.
In other words, it combines all lists into one list and eliminates any duplicates.

Declaration

list of anytype LSTgetUnion (varargs of list of anytype laLists);

Inputs

laLists
A list containing two or more lists to be used to determine the Union.

Returns

The list of items that make up the Union.
NOTE: any duplicate items are discarded (only listed once).

Example of Usage

//Union of 3 lists (A+B+C):

liUnion = LSTgetUnion({1,2,3,4,5,6}, {5,6,7,8}, {8,9,10});
	
//liUnion would be {1,2,3,4,5,6,7,8,9,10}.
//duplicate items are discarded (only listed once).


LSTgetSymmetricDifference

Returns a list containing only those items the are unique to only one of the supplied lists (an item in list 1 OR list 2 but NOT both). NOTE: any duplicate items are discarded (only listed once).

Declaration

list of anytype LSTgetSymmetricDifference (varargs of list of anytype laLists);

Inputs

laLists
A list containing two or more lists to be used to determine the Symmetric Difference.

Returns

The list of items that make up the Symmetric Difference.
NOTE: any duplicate items are discarded (only listed once).

Example of Usage

liDifference = LSTgetSymmetricDifference({1,2,3,4}, {3,4,5,6,7}, {7,8,9});
	//liDifference would be {1,2,5,6,8,9}.
	

LSTgetIntersection

Returns a list containing only those items that are common to ALL of the supplied lists.
NOTE: any duplicate items are discarded (only listed once).

Declaration

list of anytype LSTgetIntersection (varargs of list of anytype laLists);

Inputs

laLists
A list containing two or more lists to be used to determine the Intersection.

Returns

The list of items that make up the Intersection between the supplied lists.
NOTE: any duplicate items are discarded (only listed once).

Example of Usage

liIntersection = LSTgetIntersection({1,2,3,4,5}, {3,4,5,6,7}, {5,6,7,8,9});
	//liIntersection would be {5}.
	


This page is maintained by (REMOVED).
Last updated 8 June 1998.