sublist SciMax Toolbox submatrix

SciMax Toolbox >> sublist_indices

sublist_indices

Maxima Function

Calling Sequence

sublist_indices (L, P)

Description

Returns the indices of the elements x of the list L for which the predicate maybe(P(x)) returns true; this excludes unknown as well as false. P may be the name of a function or a lambda expression. L must be a literal list.

Examples:

(%i1) sublist_indices ('[a, b, b, c, 1, 2, b, 3, b],
                       lambda ([x], x='b));
(%o1)                     [2, 3, 7, 9]
(%i2) sublist_indices ('[a, b, b, c, 1, 2, b, 3, b], symbolp);
(%o2)                  [1, 2, 3, 4, 7, 9]
(%i3) sublist_indices ([1 > 0, 1 < 0, 2 < 1, 2 > 1, 2 > 0],
                       identity);
(%o3)                       [1, 4, 5]
(%i4) assume (x < -1);
(%o4)                       [x < - 1]
(%i5) map (maybe, [x > 0, x < 0, x < -2]);
(%o5)                [false, true, unknown]
(%i6) sublist_indices ([x > 0, x < 0, x < -2], identity);
(%o6)                          [2]
sublist SciMax Toolbox submatrix