 |
all_tail |
Function (ROM Call 0x3B5) |
Checks whether all elements in the list have some property.
all_tail is similar to map_tail, but callback function f is
not void. It needs to return a Boolean value (TRUE or FALSE).
If f returns FALSE, any further processing of the list tail will
be stopped, even if END_TAG is not reached yet. The result of all_tail is
the last value returned from f. In other words, it returns TRUE if
and only if the callback function f returns TRUE for each expression
in the tail of expressions indexed by element_ptr.
all_tail is very useful to check whether all elements of a list possess some property. Suppose
that you defined the following function which checks whether an entry on the expression stack is a positive
integer:
short is_positive_integer (ESI ptr)
{
return (*ptr == POSINT_TAG);
}
and suppose that start_ptr points to the first element of the list (one byte below
LIST_TAG). Then, you can use the following call to check whether all
elements of the lists are positive integers:
are_all_positive_integers = all_tail (is_positive_integer, start_ptr);
Uses: next_expression_index
Used by: NG_graphESI, did_push_anti_deriv, did_push_series, push_1st_derivative, push_csolve, push_czeros, push_def_int, push_desolve, push_extended_prod, push_factor, push_lim, push_max, push_min, push_nsolve, push_rec_to_angle, push_solve, push_summation, push_zeros, push_equals, push_exponentiate, push_greater_than, push_greater_than_or_equals, push_less_than, push_less_than_or_equals, push_not_equals, push_product, push_sum, get_ub, is_cFloat_agg, is_constant, push_reciprocal, push_user_func, ROM Call 0x4D1