2023-04-05

(sph vector)

vector processing

part of sph-lib

module name

(sph vector)

exported bindings

procedure: alist-values->vector alist ->
create a vector of alist values
procedure: any->vector a ->
variable: sph-vector-description
procedure: vector->index-alist a ->
#(any ...) -> ((integer:index . any) ...)
procedure: vector-accessor index ->
integer -> procedure:{vector -> any}
return a procedure that when called with a vector returns the value at index
procedure: vector-append a b ->
concatenate \"b\" at the end of \"a\".
#(1 2) #(3 4) -> #(1 2 3 4)
create a new bigger vector and copy all elements of \"a\" and \"b\" to it
procedure: vector-copy* a f ->
call f with a copy of vector and after f finishes return it
procedure: vector-delete-duplicates a [equal?] ->
vector [procedure] -> vector
creates a new vector with duplicate elements removed
procedure: vector-deselect a indices ->
vector (integer ...) -> vector
return a new, possibly smaller, vector consisting of values not at specified indices
procedure: vector-each f v ->
(vector-for-each f vec1 vec2 ...) -> unspecified
Call @code{(f (vector-ref vec1 i) (vector-ref vec2 i) ...)} for each index
in the provided vectors, which have to be of equal length. The iteration
is strictly left-to-right.
procedure: vector-each-with-index f v ->
(vector-for-each f vec1 vec2 ...) -> unspecified
Call (F i VEC1[i] VEC2[i] ...) for each index i less than the length
The iteration is strictly
left-to-right.
procedure: vector-extend a add-size ->
vector integer -> vector
increase size of vector.
new slots are appended to vector
procedure: vector-first a ->
procedure: vector-from-index-alist size a ->
((integer:index . any) ...) -> #(any ...)
procedure: vector-index-value a value [equal-f] ->
vector any [procedure] -> integer/falso
find the index in vector at which value occurs or return false
procedure: vector-map f v ->
(vector-map f vec2 vec2 ...) -> vector
Return a new vector of the size of the vector arguments, which must be
The dynamic order of application of
@var{f} is unspecified.
procedure: vector-map-with-index f a ... ->
procedure:{integer:index any -> any} vector ... -> vector
map each vector element suppliing its index to the
mapping procedure and result in a new vector
procedure: vector-object a ->
vector -> procedure:{integer -> any}
returns a procedure that when called with an index returns the value at index
procedure: vector-range a start [end] ->
vector [integer integer] -> vector
get a sub-vector.
start and end are inclusive
procedure: vector-relative-change-index/value a b ->
#(number ...) #(number ...) -> number
return a number that describes the amount of change between
two numeric vectors based on value and index shifts.
it sorts values by magnitude and compares relative changes.
the result is a change factor with small values meaning little change.
all vectors must be of equal length
procedure: vector-second a ->
procedure: vector-select a indices ->
vector (integer ...) -> vector
return a new vector consisting of values at indices specified by vector indices
procedure: vector-setter index ->
integer -> procedure:{vector value -> unspecified}
return a procedure that when called with a vector and a value sets index to value
procedure: vector-third a ->
procedure: vector-update a index/value ... ->
vector [integer any] ... -> vector
create a copy of the given vector with values at indices set to new values.
index and value are given alternatingly.
example: (vector-update myvector 1 #\a 4 #\b)