Next: , Previous: SRFI-4 API, Up: SRFI-4   [Contents][Index]


7.5.5.3 SRFI-4 - Generic operations

Guile also provides procedures that operate on all types of uniform numeric vectors. In what is probably a bug, these procedures are currently available in the default environment as well; however prudent hackers will make sure to import (srfi srfi-4 gnu) before using these.

C Function: int scm_is_uniform_vector (SCM uvec)

Return non-zero when uvec is a uniform numeric vector, zero otherwise.

C Function: size_t scm_c_uniform_vector_length (SCM uvec)

Return the number of elements of uvec as a size_t.

Scheme Procedure: uniform-vector? obj
C Function: scm_uniform_vector_p (obj)

Return #t if obj is a homogeneous numeric vector of the indicated type.

Scheme Procedure: uniform-vector-length vec
C Function: scm_uniform_vector_length (vec)

Return the number of elements in vec.

Scheme Procedure: uniform-vector-ref vec i
C Function: scm_uniform_vector_ref (vec, i)

Return the element at index i in vec. The first element in vec is index 0.

Scheme Procedure: uniform-vector-set! vec i value
C Function: scm_uniform_vector_set_x (vec, i, value)

Set the element at index i in vec to value. The first element in vec is index 0. The return value is unspecified.

Scheme Procedure: uniform-vector->list vec
C Function: scm_uniform_vector_to_list (vec)

Return a newly allocated list holding all elements of vec.

C Function: const void * scm_uniform_vector_elements (SCM vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)

Like scm_vector_elements (see Vector Accessing from C), but returns a pointer to the elements of a uniform numeric vector.

C Function: void * scm_uniform_vector_writable_elements (SCM vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)

Like scm_vector_writable_elements (see Vector Accessing from C), but returns a pointer to the elements of a uniform numeric vector.

Unless you really need to the limited generality of these functions, it is best to use the type-specific functions, or the array accessors.


Next: , Previous: SRFI-4 API, Up: SRFI-4   [Contents][Index]