Guile has a number of data types that are generally vector-like: strings, uniform numeric vectors, bitvectors, and of course ordinary vectors of arbitrary Scheme values. These types are disjoint: a Scheme value belongs to at most one of the four types listed above.

If you want to gloss over this distinction and want to treat all four
types with common code, you can use the procedures in this section.
They work with the *generalized vector* type, which is the union
of the four vector-like types.

— Scheme Procedure: **generalized-vector?**` obj`

— C Function:**scm_generalized_vector_p** (`obj`)

— C Function:

Return

`#t`

ifobjis a vector, string, bitvector, or uniform numeric vector.

— Scheme Procedure: **generalized-vector-length**` v`

— C Function:**scm_generalized_vector_length** (`v`)

— C Function:

Return the length of the generalized vector

v.

— Scheme Procedure: **generalized-vector-ref**` v idx`

— C Function:**scm_generalized_vector_ref** (`v, idx`)

— C Function:

Return the element at index

idxof the generalized vectorv.

— Scheme Procedure: **generalized-vector-set!**` v idx val`

— C Function:**scm_generalized_vector_set_x** (`v, idx, val`)

— C Function:

Set the element at index

idxof the generalized vectorvtoval.

— Scheme Procedure: **generalized-vector->list**` v`

— C Function:**scm_generalized_vector_to_list** (`v`)

— C Function:

Return a new list whose elements are the elements of the generalized vector

v.

— C Function: int **scm_is_generalized_vector** (`SCM obj`)

Return

`1`

ifobjis a vector, string, bitvector, or uniform numeric vector; else return`0`

.

— C Function: size_t **scm_c_generalized_vector_length** (`SCM v`)

Return the length of the generalized vector

v.

— C Function: SCM **scm_c_generalized_vector_ref** (`SCM v, size_t idx`)

Return the element at index

idxof the generalized vectorv.

— C Function: void **scm_c_generalized_vector_set_x** (`SCM v, size_t idx, SCM val`)

Set the element at index

idxof the generalized vectorvtoval.

— C Function: void **scm_generalized_vector_get_handle** (`SCM v, scm_t_array_handle *handle`)

Like

`scm_array_get_handle`

but an error is signalled whenvis not of rank one. You can use`scm_array_handle_ref`

and`scm_array_handle_set`

to read and write the elements ofv, or you can use functions like`scm_array_handle_<foo>_elements`

to deal with specific types of vectors.