Next: Arrays, Previous: Bit Vectors, Up: Compound Data Types
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.
Return
#tif obj is a vector, string, bitvector, or uniform numeric vector.
Return the length of the generalized vector v.
Return the element at index idx of the generalized vector v.
Set the element at index idx of the generalized vector v to val.
Return a new list whose elements are the elements of the generalized vector v.
Return
1if obj is a vector, string, bitvector, or uniform numeric vector; else return0.
Return the length of the generalized vector v.
Return the element at index idx of the generalized vector v.
Set the element at index idx of the generalized vector v to val.
Like
scm_array_get_handlebut an error is signalled when v is not of rank one. You can usescm_array_handle_refandscm_array_handle_setto read and write the elements of v, or you can use functions likescm_array_handle_<foo>_elementsto deal with specific types of vectors.