Next: , Previous: , Up: vectors   [Index]


24.11 Searching

Function: %vector-index pred vec start past
Function: %vector-index-right pred vec start past
Macro: vector-index V pred
Macro: vector-index-right V pred

Search through the subvector from the left or right, returning the index of the first occurrence of an item which satisfies the predicate pred. If no match is found: Return #f.

Function: %vector-skip pred vec start past
Function: %vector-skip-right pred vec start past
Macro: vector-skip V pred
Macro: vector-skip-right V pred

Search through the vector from the left or right, returning the index of the first occurrence of an item which does not satisfy the predicate pred. If no match is found: Return #f.

Function: %vector-count pred vec start past
Macro: vector-count V pred

Return a count of the number of items in vec that satisfy the pred argument.

Function: %vector-contains vec1 start1 past1 vec2 start2 past2
Macro: vector-contains V1 V2

Return true if the selected subvector of vec1 contains the selected subvector of vec2, else return #f. The return value is the index in vec1 where the subvector of vec2 occurs.

Function: %vector-binary-search obj cmp vec start past
Macro: vector-binary-search V obj cmp

Similar to vector-index and vector-index-right, but instead of searching left to right or right to left, perform a binary search. cmp should be a procedure of two arguments and return:

An example cmp might be:

(lambda (char1 char2)
  (cond ((char<? char1 char2) -1)
        ((char=? char1 char2)  0)
        (else                  1)))

Next: , Previous: , Up: vectors   [Index]