ListTools[Categorize] - categorize the elements of a list according to a given routine
|
Calling Sequence
|
|
Categorize(f, L, opts, ...)
|
|
Parameters
|
|
L
|
-
|
list
|
f
|
-
|
procedure
|
opts
|
-
|
(optional) options to procedure f
|
|
|
|
|
Description
|
|
•
|
The Categorize(f, L, opts) function categorizes the list L into lists such that f(Mi[1], j, opts) returns true for each element j in the ith list Mi. The procedure f must return a value of type truefalse.
|
•
|
If f defines an equivalence relation, then the result is a partition of L into equivalence classes.
|
•
|
If f can be written in the form (x,y) -> g(x) = g(y), then the call ListTools[Classify](g, L, opts) is more efficient, and equivalent except in the form of the output (Classify returns a table of sets).
|
|
|
Examples
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
>
|
|
| (5) |
|
|
Download Help Document
Was this information helpful?