These functions manipulate arrays and lists as sets.
Extract the elements of a set that are not contained in other sets.
indices = complement (a, b, ..., c)
This function computes the elements of the first argument (a)
that are not contained in the sets given by the other arguments
(b,...,c) and returns them in the form of indices into the
first argument.
a = {"foo", PI, 7};
b = [1,2,3,PI];
indices = complement (a, b);
Upon return, indices will have the value [0, 2] since
a[0] and a[2] are not contained in b.
A set may either be an Array_Type or a List_Type object.
For a homogeneous collection of objects, it is better to
use an Array_Type. i.e., [1,2,3] instead of {1,2,3}.
intersection, ismember, union, unique
Extract the common elements of two or more sets
indices = complement (a, b, ..., c)
This function computes the common elements of two or more sets and returns them in the form of indices into the first argument.
a = {"foo", 7, PI};
b = {PI, "bar", "foo"};
indices = intersection (a, b);
Upon return, indices will have the value [0, 2] since
a[0] and a[2] are the common elements of the sets.
A set may either be an Array_Type or a List_Type object.
For a homogeneous collection of objects, it is better to
use an Array_Type. i.e., [1,2,3] instead of {1,2,3}.
complement, ismember, union, unique
test to see if the elements of one set are members of another
val = ismember (a, b)
This function may be used to see which of the elements of the set
a are members of the set b. It returns a boolean
array indicating whether or not the corresponding element of
a is a member of b.
A set may either be an Array_Type or a List_Type object.
For a homogeneous collection of objects, it is better to
use an Array_Type. i.e., [1,2,3] instead of {1,2,3}.
complement, intersection, union, unique
Form a set of the unique elements of one ore more subsets
abc = union (a, b,..., c)
This function interprets each of its arguments as a set, then merges
them together and returns only the unique elements. The returned
value may either be an Array_Type or a List_Type
object.
A set may either be an Array_Type or a List_Type object.
For a homogeneous collection of objects, it is better to
use an Array_Type. i.e., [1,2,3] instead of {1,2,3}.
complement, intersection, ismember, unique
Get the indices of the unique elements of a set
indices = unique (A)
This function returns an array of the indices of the unique elements of a set.
A set may either be an Array_Type or a List_Type object.
For a homogeneous collection of objects, it is better to
use an Array_Type. i.e., [1,2,3] instead of {1,2,3}.
complement, intersection, ismember, union