chickadee » generic-number-vectors » make-number-vector

(make-number-vector TYPE N [VALUE NONGC FINALIZE]) procedure

Return a newly-allocated SRFI-4 homogeneous number vector of length N and type TYPE.

If the optional fill VALUE is specified, it specifies the initial value for each slot in the vector. If not, the content of the vector is unspecified but individual elements of the vector are guaranteed to be in the range of values permitted for that type of vector.

The type of the fill value must be compatible with the elements of the vector datatype. It is an error if otherwise -- for example, if an inexact integer is passed to make-u8vector.

On Chicken, these procedures have been extended to allow allocating the storage in non-garbage collected memory, as follows:

The optional arguments NONGC and FINALIZE define whether the vector should be allocated in a memory area not subject to garbage collection and whether the associated storage should be automatically freed (using finalization) when there are no references from Scheme variables and data. NONGC defaults to #f (the vector will be located in normal garbage collected memory) and FINALIZE defaults to #t. Note that the FINALIZE argument is only used when NONGC is true.