Module vector-search

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.


find-first-key[Method]

Find the index of first element of a <vector>

Synopsis

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

Parameters

seqAn instance of <vector>.
pred?An instance of <object>. A <function> that returns #t for a matching condition.
start:An instance of <object>. From which element to start the search Defaults to 0.
end:An instance of <object>. Where to end the search
failure:An instance of <object>. Returned if no match found

Return Values

None.

Description

Find the index of first element (after start but before end) of a vector which satisfies the given predicate. If no matching element is found, return failure. 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[Method]

This is like find-first-key, but goes backward from end.

Synopsis

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

Parameters

seqAn instance of <vector>.
pred?An instance of <object>. A <function> that returns true for a matching condition
start:An instance of <object>. From which element to start the search Defaults to 0.
end:An instance of <object>. Where to end the search
failure:An instance of <object>. Returned if no match found

Return Values

None.

Description

See the description for find-first-key.