 for (i, a) in pairs(A)
 testf(a) && return i
 end
 return nothing
 end

 # Needed for bootstrap, and allows defining only an optimized findnext method
 findfirst(testf::Function, A::Union{AbstractArray, AbstractString}) =
 findnext(testf, A, first(keys(A)))

 function findfirst(p::Union{Fix2{typeof(isequal),T},Fix2{typeof(==),T}}, r::StepRange{T,S}) where {T,S}
 first(r) <= p.x <= last(r)  return nothing
 d = convert(S, p.x  first(r))
 iszero(d % step(r))  return nothing
 return d ÷ step(r) + 1
 end

 """
 findprev(A, i)

 Find the previous index before or including `i` of a `true` element of `A`,