UniCoreFW

every()

Check if every element in the array matches the predicate.

Implementation

Args: array: The array to check func: A predicate function Returns: True if all elements match, False otherwise

Example

every([1, 2, 3], lambda x: x > 0)

Expected output: True

Source Code

def every(array: List[T], func: Callable[[T], bool]) -> bool: return all(func(x) for x in array)