chickadee » chunk-vector

Outdated egg!

This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

chunk-vector

Description

A dyn-vector like library capable of storing other srfi-4 vectors inside a dense array.

Author

Richard van Roy (pluizer)

Requirements

none

Documentation

Procedures

make-f32chunk-vector size #!optional size-hintprocedure
make-f64chunk-vector size #!optional size-hintprocedure
make-s8chunk-vector size #!optional size-hintprocedure
make-s16chunk-vector size #!optional size-hintprocedure
make-s32chunk-vector size #!optional size-hintprocedure
make-u8chunk-vector size #!optional size-hintprocedure
make-u16chunk-vector size #!optional size-hintprocedure
make-u32chunk-vector size #!optional size-hintprocedure

Create a new chunk vector with a chunk-size of size.

f32chunk-vector-remove! vector indexprocedure
f64chunk-vector-remove! vector indexprocedure
s8chunk-vector-remove! vector indexprocedure
s16chunk-vector-remove! vector indexprocedure
s32chunk-vector-remove! vector indexprocedure
u8chunk-vector-remove! vector indexprocedure
u16chunk-vector-remove! vector indexprocedure
u32chunk-vector-remove! vector indexprocedure

Removes a chunk from the vector using its index.

f32chunk-vector-set! vector index valueprocedure
f64chunk-vector-set! vector index valueprocedure
s8chunk-vector-set! vector index valueprocedure
s16chunk-vector-set! vector index valueprocedure
s32chunk-vector-set! vector index valueprocedure
u8chunk-vector-set! vector index valueprocedure
u16chunk-vector-set! vector index valueprocedure
u32chunk-vector-set! vector index valueprocedure

Changed the value of a chunk using its index.

f32chunk-vector-push! vector valueprocedure
f64chunk-vector-push! vector valueprocedure
s8chunk-vector-push! vector valueprocedure
s16chunk-vector-push! vector valueprocedure
s32chunk-vector-push! vector valueprocedure
u8chunk-vector-push! vector valueprocedure
u16chunk-vector-push! vector valueprocedure
u32chunk-vector-push! vector valueprocedure

Pushes a new chunk to the vector.

f32chunk-vector-ref vector indexprocedure
f64chunk-vector-ref vector indexprocedure
s8chunk-vector-ref vector indexprocedure
s16chunk-vector-ref vector indexprocedure
s32chunk-vector-ref vector indexprocedure
u8chunk-vector-ref vector indexprocedure
u16chunk-vector-ref vector indexprocedure
u32chunk-vector-ref vector indexprocedure

Returns the data at index.

f32chunk-vector-length vectorprocedure
f64chunk-vector-length vectorprocedure
s8chunk-vector-length vectorprocedure
s16chunk-vector-length vectorprocedure
s32chunk-vector-length vectorprocedure
u8chunk-vector-length vectorprocedure
u16chunk-vector-length vectorprocedure
u32chunk-vector-length vectorprocedure

Returns the number of chunks in the vector.

f32chunk-vector->pointer vectorprocedure
f64chunk-vector->pointer vectorprocedure
s8chunk-vector->pointer vectorprocedure
s16chunk-vector->pointer vectorprocedure
s32chunk-vector->pointer vectorprocedure
u8chunk-vector->pointer vectorprocedure
u16chunk-vector->pointer vectorprocedure
u32chunk-vector->pointer vectorprocedure

Returns a pointer to the dense foreign array where the data is stored.

Example

(use chunk-vector)

;; Create a chunk-vector that holds f32vectors with the size of 2.
(define v (make-f32chunk-vector 2))

(define index-a (f32chunk-vector-push! v (f32vector 1 2)))

(define index-b (f32chunk-vector-push! v (f32vector 3 4)))

(define index-c (f32chunk-vector-push! v (f32vector 7 8)))

(f32chunk-vector-remove! v index-c)

(f32chunk-vector-set! v index-b (f32vector 0 0))

(print (f32chunk-vector-ref v index-a)) ; => #f32(1.0 2.0)

(print (f32chunk-vector-ref v index-b)) ; => #f32(0.0 0.0)

(print (f32chunk-vector-ref v index-c)) ; undefined

Contents »