|
Calling Sequence
|
|
Classify(p, L, b1, ..., bn)
|
|
Parameters
|
|
p
|
-
|
characteristic property defining a class
|
L
|
-
|
list, set, table, or rtable; the object containing elements to be classified
|
b1, ..., bn
|
-
|
(optional) extra arguments passed to p
|
|
|
|
|
Description
|
|
•
|
The Classify(p, L, b1, ..., bn) function groups the elements of L into sets according to the characteristic property p. That is, it returns a table T with indices i such that T[i] is the set of elements e of L having value p(e, b1, ..., bn) = i.
|
•
|
If L is a table or rtable (such as an Array, Matrix, or Vector), the result is equivalent to applying this function to convert(L,list) with all other arguments the same. (See convert/list.)
|
•
|
The call Classify(p, L, b1, ..., bn) is mostly equivalent to ListTools[Categorize]((x, y) -> p(x)=p(y), L, b1, ..., bn) but more efficient. The form of the output is also different: Categorize returns a sequence of lists, while Classify returns a table of sets. On the other hand, Categorize is more general in that it accepts two-argument relations which can not necessarily be written in the form (x, y) -> p(x)=p(y) for some property p.
|
|
|
Examples
|
|
|
|
Compatibility
|
|
•
|
The ListTools[Classify] command was introduced in Maple 16.
|
|
|
|