Skip to main content

bisect_keep_left

Find the index of the first element from the start of the array that verifies the given condition. The function is applied from the start of the array to the pivot.

def bisect_keep_left(
a: list,
fn: callable
) - > int

Find the index of the first element from the start of the array that verifies the given condition. The function is applied from the start of the array to the pivot.

Parameters

NameTypeDescription
alistThe sequence of elements to be searched.
fncallableA predicate function that accepts a slice of the array from the beginning to the current pivot and returns a boolean.

Returns

TypeDescription
intThe zero-based index of the first element that satisfies the condition, or the length of the array if no elements satisfy it.