chickadee » vector-lib » vector-binary-search

Similar to vector-index and vector-index-right, but instead of searching left to right or right to left, this performs a binary search. cmp should be a procedure of two arguments and return a negative integer, which indicates that its first argument is less than its second, zero, which indicates that they are equal, or a positive integer, which indicates that the first argument is greater than the second argument. An example cmp might be:

(λ (char_1 char_2)
  (cond ((char<? char_1 char_2) -1)
        ((char=? char_1 char_2) 0)
        (else 1)))