2017-08-27

(sph vector)

vector processing

part of sph-lib

import name

(sph vector)

exports

alist-values->vector

procedure

signature

alist ->

description

create a vector of alist values

sph-vector-description

variable

vector-accessor

procedure

signature

index ->

integer -> procedure:{vector -> any}

description

returns a procedure that when called with a vector returns the value at index

vector-append

procedure

signature

a b ->

description

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

vector-copy*

procedure

signature

a proc ->

description

call proc with a copy of vector and after proc finishes return it

vector-delete-duplicates

procedure

signature

a [equal?] ->

vector [procedure] -> vector

description

creates a new vector with duplicate elements removed

vector-deselect

procedure

signature

a indices ->

vector (integer ...) -> vector

description

return a new, possibly smaller, vector consisting of values not at specified indices

vector-each

procedure

signature

proc vecs ... ->

vector-each-with-index

procedure

signature

proc a [index-offset] ->

procedure vector [integer] -> unspecified

description

proc is called as (proc element index).

index-offset is added to the actual index that is passed to proc

vector-extend

procedure

signature

a add-size ->

vector integer -> vector

description

increase size of vector.

new slots are appended to vector

vector-first

procedure

signature

a ->

vector-index-value

procedure

signature

a value [equal-proc] ->

vector any [procedure] -> integer/falso

description

find the index in vector at which value occurs or return false

vector-map-with-index

procedure

signature

proc a ->

procedure {any integer -> any} vector -> vector

description

map each vector element suppliing its index to the

mapping procedure and result in a new vector

vector-object

procedure

signature

a ->

vector -> procedure:{integer -> any}

description

returns a procedure that when called with an index returns the value at index

vector-range

procedure

signature

a start [end] ->

vector [integer integer] -> vector

description

get a sub-vector.

start and end are inclusive

vector-second

procedure

signature

a ->

vector-select

procedure

signature

a indices ->

vector (integer ...) -> vector

description

return a new vector consisting of values at indices specified by vector indices

vector-third

procedure

signature

a ->

vector-update

procedure

signature

a index/value ... ->

vector [integer any] ... -> vector

description

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 # 4 #)


tags: programming guile documentation library scheme sph-lib vector sph-vector