3.8 C Array Types
procedure
(make-array-type type count) → ctype?
type : ctype? count : exact-nonnegative-integer?
Since an array is treated like a struct, casting a pointer type to an array type does not work. Instead, use ptr-ref with a pointer, an array type constructed with _array, and index 0 to convert a pointer to a Racket representation that works with array-ref and array-set!.
procedure
type : ctype? count : exact-nonnegative-integer?
Supply multiple counts for a multidimensional array. Since C uses row-major order for arrays, (_array t n m) is equivalent to (_array (_array t m) n), which is different from an array of pointers to arrays.
When a value is used as an instance of an array type (e.g., as passed to a foreign function), checking ensures that the given value is an array of at least the expected length and whose elements have the same representation according to ctype->layout; the array can have additional elements, and it can have a different element type as long as that type matches the layout of the expected type.
procedure
a : array? i : exact-nonnegative-integer?
procedure
(array-set! a i ...+ v) → void?
a : array? i : exact-nonnegative-integer? v : any/c
procedure
a : array?
procedure
(array-type a) → ctype?
a : array?
procedure
a : array? start : exact-nonnegative-integer? = 0 stop : (or/c exact-integer? #f) = #f step : (and/c exact-integer? (not/c zero?)) = 1
The optional arguments start, stop, and step are as in in-vector.
procedure
(_array/list type count ...+) → ctype?
type : ctype? count : exact-nonnegative-integer?
procedure
(_array/vector type count ...+) → ctype?
type : ctype? count : exact-nonnegative-integer?