apply_predicate
apply_predicate[predicate: def(IntTuple, IntTuple) -> Bool](a: IntTuple, b: IntTuple) -> Bool
Apply a predicate function recursively to two IntTuples.
This function traverses two IntTuples with the same structure and applies
a predicate function to corresponding elements. The predicate is applied
only to the leaf nodes (integer values).
Note:
If the structures of the two IntTuples don't match (different nesting or length),
the function returns False without applying the predicate.
Parameters:
- predicate (
def(IntTuple, IntTuple) -> Bool): A function that takes twoIntTuples (containing integer values) and returns a boolean result.
Args:
Returns:
Bool: True if the predicate returns True for all corresponding elements and
the structures match, False otherwise.