On this page:
make-u8vector
u8vector
u8vector?
u8vector-length
u8vector-ref
u8vector-set!
list->u8vector
u8vector->list
u8vector->cpointer
_  u8vector
make-s8vector
s8vector
s8vector?
s8vector-length
s8vector-ref
s8vector-set!
list->s8vector
s8vector->list
s8vector->cpointer
_  s8vector
make-s16vector
s16vector
s16vector?
s16vector-length
s16vector-ref
s16vector-set!
list->s16vector
s16vector->list
s16vector->cpointer
_  s16vector
make-u16vector
u16vector
u16vector?
u16vector-length
u16vector-ref
u16vector-set!
list->u16vector
u16vector->list
u16vector->cpointer
_  u16vector
make-s32vector
s32vector
s32vector?
s32vector-length
s32vector-ref
s32vector-set!
list->s32vector
s32vector->list
s32vector->cpointer
_  s32vector
make-u32vector
u32vector
u32vector?
u32vector-length
u32vector-ref
u32vector-set!
list->u32vector
u32vector->list
u32vector->cpointer
_  u32vector
make-s64vector
s64vector
s64vector?
s64vector-length
s64vector-ref
s64vector-set!
list->s64vector
s64vector->list
s64vector->cpointer
_  s64vector
make-u64vector
u64vector
u64vector?
u64vector-length
u64vector-ref
u64vector-set!
list->u64vector
u64vector->list
u64vector->cpointer
_  u64vector
make-f32vector
f32vector
f32vector?
f32vector-length
f32vector-ref
f32vector-set!
list->f32vector
f32vector->list
f32vector->cpointer
_  f32vector
make-f64vector
f64vector
f64vector?
f64vector-length
f64vector-ref
f64vector-set!
list->f64vector
f64vector->list
f64vector->cpointer
_  f64vector
make-f80vector
f80vector
f80vector?
f80vector-length
f80vector-ref
f80vector-set!
list->f80vector
f80vector->list
f80vector->cpointer
_  f80vector

5.1 Safe Homogenous Vectors

 (require ffi/vector)

Homogenous vectors are similar to C vectors (see Safe C Vectors), except that they define different types of vectors, each with a fixed element type. An exception is the u8 family of bindings, which are just aliases for byte-string bindings; for example, make-u8vector is an alias for make-bytes.

procedure

(make-u8vector len)  u8vector?

  len : exact-nonnegative-integer?
(u8vector val ...)  u8vector?
  val : byte?
(u8vector? v)  boolean?
  v : any/c
(u8vector-length vec)  exact-nonnegative-integer?
  vec : u8vector?
(u8vector-ref vec k)  byte?
  vec : u8vector?
  k : exact-nonnegative-integer?
(u8vector-set! vec k val)  void?
  vec : u8vector?
  k : exact-nonnegative-integer?
  val : byte?
(list->u8vector lst)  u8vector?
  lst : (listof byte?)
(u8vector->list vec)  (listof byte?)
  vec : u8vector?
(u8vector->cpointer vec)  cpointer?
  vec : u8vector?
Like _cvector, but for vectors of _uint8 elements. These are aliases for byte operations, where u8vector->cpointer is the identity function.

syntax

(_u8vector mode maybe-len)

_u8vector
Like _cvector, but for vectors of _uint8 elements.

procedure

(make-s8vector len)  s8vector?

  len : exact-nonnegative-integer?
(s8vector val ...)  s8vector?
  val : (integer-in -128 127)
(s8vector? v)  boolean?
  v : any/c
(s8vector-length vec)  exact-nonnegative-integer?
  vec : s8vector?
(s8vector-ref vec k)  (integer-in -128 127)
  vec : s8vector?
  k : exact-nonnegative-integer?
(s8vector-set! vec k val)  void?
  vec : s8vector?
  k : exact-nonnegative-integer?
  val : (integer-in -128 127)
(list->s8vector lst)  s8vector?
  lst : (listof (integer-in -128 127))
(s8vector->list vec)  (listof (integer-in -128 127))
  vec : s8vector?
(s8vector->cpointer vec)  cpointer?
  vec : s8vector?
Like make-vector, etc., but for _int8 elements. The s8vector->cpointer function extracts a plain pointer to the underlying array.

syntax

(_s8vector mode maybe-len)

_s8vector
Like _cvector, but for vectors of _int8 elements.

procedure

(make-s16vector len)  s16vector?

  len : exact-nonnegative-integer?
(s16vector val ...)  s16vector?
  val : (integer-in -32768 32767)
(s16vector? v)  boolean?
  v : any/c
(s16vector-length vec)  exact-nonnegative-integer?
  vec : s16vector?
(s16vector-ref vec k)  (integer-in -32768 32767)
  vec : s16vector?
  k : exact-nonnegative-integer?
(s16vector-set! vec k val)  void?
  vec : s16vector?
  k : exact-nonnegative-integer?
  val : (integer-in -32768 32767)
(list->s16vector lst)  s16vector?
  lst : (listof (integer-in -32768 32767))
(s16vector->list vec)  (listof (integer-in -32768 32767))
  vec : s16vector?
(s16vector->cpointer vec)  cpointer?
  vec : s16vector?
Like make-vector, etc., but for _int16 elements. The s16vector->cpointer function extracts a plain pointer to the underlying array.

syntax

(_s16vector mode maybe-len)

_s16vector
Like _cvector, but for vectors of _int16 elements.

procedure

(make-u16vector len)  u16vector?

  len : exact-nonnegative-integer?
(u16vector val ...)  u16vector?
  val : (integer-in 0 65535)
(u16vector? v)  boolean?
  v : any/c
(u16vector-length vec)  exact-nonnegative-integer?
  vec : u16vector?
(u16vector-ref vec k)  (integer-in 0 65535)
  vec : u16vector?
  k : exact-nonnegative-integer?
(u16vector-set! vec k val)  void?
  vec : u16vector?
  k : exact-nonnegative-integer?
  val : (integer-in 0 65535)
(list->u16vector lst)  u16vector?
  lst : (listof (integer-in 0 65535))
(u16vector->list vec)  (listof (integer-in 0 65535))
  vec : u16vector?
(u16vector->cpointer vec)  cpointer?
  vec : u16vector?
Like make-vector, etc., but for _uint16 elements. The u16vector->cpointer function extracts a plain pointer to the underlying array.

syntax

(_u16vector mode maybe-len)

_u16vector
Like _cvector, but for vectors of _uint16 elements.

procedure

(make-s32vector len)  s32vector?

  len : exact-nonnegative-integer?
(s32vector val ...)  s32vector?
  val : (integer-in -2147483648 2147483647)
(s32vector? v)  boolean?
  v : any/c
(s32vector-length vec)  exact-nonnegative-integer?
  vec : s32vector?
(s32vector-ref vec k)  (integer-in -2147483648 2147483647)
  vec : s32vector?
  k : exact-nonnegative-integer?
(s32vector-set! vec k val)  void?
  vec : s32vector?
  k : exact-nonnegative-integer?
  val : (integer-in -2147483648 2147483647)
(list->s32vector lst)  s32vector?
  lst : (listof (integer-in -2147483648 2147483647))
(s32vector->list vec)
  (listof (integer-in -2147483648 2147483647))
  vec : s32vector?
(s32vector->cpointer vec)  cpointer?
  vec : s32vector?
Like make-vector, etc., but for _int32 elements. The s32vector->cpointer function extracts a plain pointer to the underlying array.

syntax

(_s32vector mode maybe-len)

_s32vector
Like _cvector, but for vectors of _int32 elements.

procedure

(make-u32vector len)  u32vector?

  len : exact-nonnegative-integer?
(u32vector val ...)  u32vector?
  val : (integer-in 0 4294967295)
(u32vector? v)  boolean?
  v : any/c
(u32vector-length vec)  exact-nonnegative-integer?
  vec : u32vector?
(u32vector-ref vec k)  (integer-in 0 4294967295)
  vec : u32vector?
  k : exact-nonnegative-integer?
(u32vector-set! vec k val)  void?
  vec : u32vector?
  k : exact-nonnegative-integer?
  val : (integer-in 0 4294967295)
(list->u32vector lst)  u32vector?
  lst : (listof (integer-in 0 4294967295))
(u32vector->list vec)  (listof (integer-in 0 4294967295))
  vec : u32vector?
(u32vector->cpointer vec)  cpointer?
  vec : u32vector?
Like make-vector, etc., but for _uint32 elements. The u32vector->cpointer function extracts a plain pointer to the underlying array.

syntax

(_u32vector mode maybe-len)

_u32vector
Like _cvector, but for vectors of _uint32 elements.

procedure

(make-s64vector len)  s64vector?

  len : exact-nonnegative-integer?
(s64vector val ...)  s64vector?
  val : (integer-in -9223372036854775808 9223372036854775807)
(s64vector? v)  boolean?
  v : any/c
(s64vector-length vec)  exact-nonnegative-integer?
  vec : s64vector?
(s64vector-ref vec k)
  (integer-in -9223372036854775808 9223372036854775807)
  vec : s64vector?
  k : exact-nonnegative-integer?
(s64vector-set! vec k val)  void?
  vec : s64vector?
  k : exact-nonnegative-integer?
  val : (integer-in -9223372036854775808 9223372036854775807)
(list->s64vector lst)  s64vector?
  lst : (listof (integer-in -9223372036854775808 9223372036854775807))
(s64vector->list vec)
  (listof (integer-in -9223372036854775808 9223372036854775807))
  vec : s64vector?
(s64vector->cpointer vec)  cpointer?
  vec : s64vector?
Like make-vector, etc., but for _int64 elements. The s64vector->cpointer function extracts a plain pointer to the underlying array.

syntax

(_s64vector mode maybe-len)

_s64vector
Like _cvector, but for vectors of _int64 elements.

procedure

(make-u64vector len)  u64vector?

  len : exact-nonnegative-integer?
(u64vector val ...)  u64vector?
  val : (integer-in 0 18446744073709551615)
(u64vector? v)  boolean?
  v : any/c
(u64vector-length vec)  exact-nonnegative-integer?
  vec : u64vector?
(u64vector-ref vec k)  (integer-in 0 18446744073709551615)
  vec : u64vector?
  k : exact-nonnegative-integer?
(u64vector-set! vec k val)  void?
  vec : u64vector?
  k : exact-nonnegative-integer?
  val : (integer-in 0 18446744073709551615)
(list->u64vector lst)  u64vector?
  lst : (listof (integer-in 0 18446744073709551615))
(u64vector->list vec)
  (listof (integer-in 0 18446744073709551615))
  vec : u64vector?
(u64vector->cpointer vec)  cpointer?
  vec : u64vector?
Like make-vector, etc., but for _uint64 elements. The u64vector->cpointer function extracts a plain pointer to the underlying array.

syntax

(_u64vector mode maybe-len)

_u64vector
Like _cvector, but for vectors of _uint64 elements.

procedure

(make-f32vector len)  f32vector?

  len : exact-nonnegative-integer?
(f32vector val ...)  f32vector?
  val : real?
(f32vector? v)  boolean?
  v : any/c
(f32vector-length vec)  exact-nonnegative-integer?
  vec : f32vector?
(f32vector-ref vec k)  real?
  vec : f32vector?
  k : exact-nonnegative-integer?
(f32vector-set! vec k val)  void?
  vec : f32vector?
  k : exact-nonnegative-integer?
  val : real?
(list->f32vector lst)  f32vector?
  lst : (listof real?)
(f32vector->list vec)  (listof real?)
  vec : f32vector?
(f32vector->cpointer vec)  cpointer?
  vec : f32vector?
Like make-vector, etc., but for _float elements. The f32vector->cpointer function extracts a plain pointer to the underlying array.

syntax

(_f32vector mode maybe-len)

_f32vector
Like _cvector, but for vectors of _float elements.

procedure

(make-f64vector len)  f64vector?

  len : exact-nonnegative-integer?
(f64vector val ...)  f64vector?
  val : real?
(f64vector? v)  boolean?
  v : any/c
(f64vector-length vec)  exact-nonnegative-integer?
  vec : f64vector?
(f64vector-ref vec k)  real?
  vec : f64vector?
  k : exact-nonnegative-integer?
(f64vector-set! vec k val)  void?
  vec : f64vector?
  k : exact-nonnegative-integer?
  val : real?
(list->f64vector lst)  f64vector?
  lst : (listof real?)
(f64vector->list vec)  (listof real?)
  vec : f64vector?
(f64vector->cpointer vec)  cpointer?
  vec : f64vector?
Like make-vector, etc., but for _double* elements. The f64vector->cpointer function extracts a plain pointer to the underlying array.

syntax

(_f64vector mode maybe-len)

_f64vector
Like _cvector, but for vectors of _double* elements.

procedure

(make-f80vector len)  f80vector?

  len : exact-nonnegative-integer?
(f80vector val ...)  f80vector?
  val : extflonum?
(f80vector? v)  boolean?
  v : any/c
(f80vector-length vec)  exact-nonnegative-integer?
  vec : f80vector?
(f80vector-ref vec k)  extflonum?
  vec : f80vector?
  k : exact-nonnegative-integer?
(f80vector-set! vec k val)  void?
  vec : f80vector?
  k : exact-nonnegative-integer?
  val : extflonum?
(list->f80vector lst)  f80vector?
  lst : (listof extflonum?)
(f80vector->list vec)  (listof extflonum?)
  vec : f80vector?
(f80vector->cpointer vec)  cpointer?
  vec : f80vector?
Like make-vector, etc., but for _longdouble elements. The f80vector->cpointer function extracts a plain pointer to the underlying array.

syntax

(_f80vector mode maybe-len)

_f80vector
Like _cvector, but for vectors of _longdouble elements.