Numeric Lists
IntList and FloatList keep numbers in Rust, so scalar ops, reductions and pairwise math run without a Python loop. Use them in place of an IList of boxed numbers when that list is the bottleneck.
from pyrula import IntList
xs = IntList([1, 2, 3, 4])
xs.mul_scalar(10) # IntList([10, 20, 30, 40])xs.clamp_vals(2, 3) # IntList([2, 2, 3, 3])xs.sum() # 10xs.mean() # 2.5
a = IntList([1, 2, 3])a.zip_add(IntList([10, 20, 30])) # IntList([11, 22, 33])Also available: add_scalar, sub_scalar, div_scalar, abs_vals, min, max, std_dev and zip_mul. IntList.div_scalar floors like //, and an IntList result outside the 64-bit range raises OverflowError.
Element-wise functions stay typed: map_int, filter and fold_left on IntList; map_float, filter and fold_left on FloatList. to_list and to_ilist leave the numeric fast path.
BytesList is an append-only list of bytes used on the serialization and Kafka paths. It has get, append, to_list and to_ilist, and packs into one buffer:
packed = blist.to_packed() # per item: u32 LE length + payloadBytesList.from_packed(packed, count=len(blist))