Nitpick Standard Collections
While Nitpick provides highly optimized built-in compiler
intrinsics for scoped collections (like astack
and ahash), it also natively defines standard
bounded collections in the type system.
1. Multi-dimensional Types
- Arrays:
array<T, N>(Fixed-size array) - Matrices:
matrix<T, Rows, Cols>(Fixed-size 2D matrix) - Tensors:
tensor<T, Dimensions...>(N-dimensional tensor for ML data)
Usage Example:
// Array of 5 integers
array<int32, 5>:grades = [90i32, 85i32, 92i32, 88i32, 95i32];
// 4x4 Transformation Matrix
matrix<flt32, 4, 4>:transform;
2. Mathematical Vectors
Nitpick provides specific vector types corresponding to
standard linear algebra concepts rather than just arrays of
data. * vec2, vec3,
vec4 (Standard 2D, 3D, and 4D mathematical
vectors)
Usage Example:
vec3:position = vec3{1.0f32, 0.0f32, -5.0f32};
3. Byte Buffers
buffer: An explicit chunk of sequential binary data, similar toVec<u8>in Rust, but tightly controlled regarding alignment and capacity bounds.
Usage Example:
buffer:network_packet = buffer::with_capacity(1024i64);