sublists(L, f, g, h)
In the first example, consecutive odd elements are grouped into sublists, while each even element is negated.
|
|
If g or h is omitted, the identity function is used in its place.
|
|
The sublists will belong to the same class as L.
|
|
Note that g acts on the sublists, not their elements.
|
Because of the grouping of consecutive elements that return true when input to f, sublists(L, f, g, h) is NOT the same as applying g to elements returning true, and applying h to elements returning false. This could be achieved with a simple if-then-else loop, or with apply.
|
|
On the other hand, if we want to group both "true" and "false" elements into sublists, we can achieve this with a second call to sublists, selecting those elements not already grouped by the first sublists command, as long as the original list was not nested.
|
|
The object sublists is a method function.
The source of this document is in Macaulay2Doc/functions/sublists-doc.m2:76:0.