2. QalamInk: The Text Builder
Used to construct massive datasets or generate text without memory fragmentation.
oInk = new QalamInk()
# Inscribe data instantly
oInk.inscribe("In the name of logic, ")
oInk.inscribe("we build the future.")
# Batch inscription (High throughput)
aLines = ["Line 1", "Line 2", "Line 3"]
oInk.inscribeBatch(aLines)
# Output
see oInk.reveal()
oInk.wipe()
3. QalamIndex: The Memory Map
An O(1) Lookup table (`std::unordered_map`) for Tokenizers.
oMemory = new QalamIndex()
# Teaching
oMemory.define("hello", 5)
oMemory.define("world", 12)
# Instant Recall
if oMemory.knows("hello")
id = oMemory.recall("hello")
ok
4. QalamChronos: The Timekeeper
A nanosecond-precision timer for benchmarking.
oTimer = new QalamChronos()
oTimer.reset()
# ... heavy operation ...
see "Time elapsed: " + oTimer.elapsed() # e.g., "450 us"
5 Formula Engine Reference
The `transform` method supports a mini-language compiled to bytecode:
Operators: `+`, `-`, `*`, `/`, `^` (Power)
Variable: `x` (Current element value)
Functions:
. `sin(x)`, `cos(x)`, `tan(x)
. `sqrt(x)`, `abs(x)`
. `log(x)`, `exp(x)`
. `relu(x)` (Rectified Linear Unit: `max(0, x)`)
Example:
# Normalize: (x - mean) / std
oVec.transform("(x - 5) / 0.2")