chunk converts a ChunkBuffer into an immutable IChunk, completing one batch for a chunked sequence. Chunking lets sequential processing fetch several items together instead of advancing one item at a time, mainly improving performance for suitable data layouts. section 10.12
Use chunk with its buffer-building companions:
- Create a mutable buffer with chunk-buffer, add values with chunk-append, then call chunk once to obtain the immutable chunk. section 10.12
- Pass the resulting chunk to chunk-cons with the remaining sequence. section 10.12
Build and consume a chunk
(def b (chunk-buffer 10)) (chunk-append b 0) (chunk-append b 1) (chunk-append b 2) (def first-chunk (chunk b)) (chunk-cons first-chunk ()) ;; (0 1 2)
