UniCoreFW

reject()

Return items that do not match the predicate.

Implementation

Args: array: The array to filter predicate: A function that returns True for items to reject Returns: A new array with rejected items removed

Example

reject([1, 2, 3], lambda x: x % 2 == 0)

Expected output: [1, 3]

Source Code

def reject(array: List[T], predicate: Callable[[T], bool]) -> List[T]: return [x for x in array if not predicate(x)]