wiki:NumericVectorsAdvancedCowan

Version 1 (modified by cowan, 5 years ago) (diff)

--

This page is an extension of NumericVectorsCowan that adds numeric vector versions of the following SRFI 43 procedures:

Folds and unfolds

(<type>vector-fold kons knil bytevector1 bytevector2 ···) -> value

(<type>vector-fold kons knil bytevector1 bytevector2 ...) -> value

(<type>vector-unfold f length initial-seed ...) -> bytevector

(<type>vector-unfold-right f length initial-seed ...) -> bytevector

Predicates

(<type>vector= = bytevector1 bytevector2 ...) -> boolean

Iteration

(<type>vector-map! proc bytevector1 bytevector2 ...) -> unspecified

Similar to <type>vector-map, but rather than mapping the new elements into a new vector, the new mapped elements are destructively inserted into bytevector1. Returns an unspecified result.

(<type>vector-count predicate bytevector1 bytevector2 ...) -> exact nonnegative integer

Counts the number of parallel elements in the vectors that satisfy predicate, which is applied, for each index i in the range [0, length), where length is the length of the smallest vector argument, to i and each parallel element in the vectors at that index, in order.

Searching

(<type>vector-index pred? bytevector1 bytevector2 ···) -> exact nonnegative integer or #f

(<type>vector-index-right pred? bytevector1 bytevector2 ···) -> exact nonnegative integer or #f

(<type>vector-skip pred? bytevector1 bytevector2 ...) -> exact nonnegative integer or #f

(<type>vector-skip-right pred? bytevector1 bytevector2 ...) -> exact nonnegative integer or #f

(<type>vector-binary-search bytevector value cmp) -> exact nonnegative integer or #f

(<type>vector-any pred? bytevector1 bytevector2 ···) -> value or #f

(<type>vector-every pred? bytevector1 bytevector2 ···) -> value or #f

Swap

(<type>vector-swap! bytevector i j) -> unspecified

Exchanges the values of the locations in bytevector, when viewed as a <type>vector, at indices i and j.

Reverse operations

(<type>vector-reverse! bytevector [start [end]]) -> unspecified

The <type>vector-reverse-copy, <type>reverse-vector->vector, <type>reverse-vector->list, <type>reverse-list->vector, and <type>reverse-list->list procedures are identical to their regular counterparts, but process the bytevector argument, when viewed as a <type>vector, in reverse order.