You are correct. assumeSorted and lowerBound will provide
better time complexity than countUntil
I'm sorry, one final question because I think I'm close to
understanding. Map produces a forward range (lazily) but not a
random access range? Therefore, lowerBound will move along this
range until the pred is not true? This means it would be better
to do:
numbers.indexed(order).assumeSorted.lowerBound
than:
map(a => numbers[a])(order).assumeSorted.lowerBound
as the lowerBound will be faster on a random access range as
produced by indexed?