The vector-search Module

Overview

The vector-search module provides basic search and replace capabilities upon restricted subsets of <sequence> – primarily <vector>. Exploiting the known properties of these types yields substantially better performance than can be achieved for sequences in general.

Reference

find-first-key Generic function
Signature:

find-first-key (seq pred? #key start end failure) => (#rest results)

Parameters:
  • seq – An instance of <vector>.

  • pred? – An instance of <function>.

  • start (#key) – An instance of <object>.

  • end (#key) – An instance of <object>.

  • failure (#key) – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

Discussion:

Find the index of the first element (after start but before end) of a vector which satisfies the given predicate. If no matching element is found, return the failure value. The defaults for start, end and failure are, respectively, 0, size(vector), and #f. This function is like find-key, but accepts start: and end: rather than skip:.

find-last-key Generic function
Signature:

find-last-key (seq pred? #key start end failure) => (#rest results)

Parameters:
  • seq – An instance of <vector>.

  • pred? – An instance of <function>.

  • start (#key) – An instance of <object>.

  • end (#key) – An instance of <object>.

  • failure (#key) – An instance of <object>.

Values:
  • #rest results – An instance of <object>.