I often find that I want to use something like
findfirst on iterables that have no (or inefficient) random access, something like
function satisfies_first(predicate, itr) for i in itr predicate(i) && return Some(i) end nothing end julia> satisfies_first(iseven ∘ first, ((i, 2*i) for i in 1:10)) Some((2, 4))
It is pretty trivial to code this, but does this exist in a package somewhere? Or
Base? I found this discussion about something similar, but I want to be careful about corner cases (element not found).