vmap
Builtin index · REPL & diagnostics
vmap(f, xs)
Input: f, xs · Output: no output
What it is
Applies f across the leading batch axis of xs — rows of a matrix, elements of a vector, items of a list — and stacks the results: a vector when every result is a scalar, a matrix (one result per row) when every result is a same-length vector, a list otherwise. This is a batched loop written in Rust, not a vectorizing transform: Qu is a tree-walking interpreter with no tracing JIT, so there is no batched kernel for a mapped function to compile into. It saves the per-iteration interpreter overhead of a Qu-level for loop, which is a constant factor, not an asymptotic win — reach for it for the result-stacking and the API shape, not for a speed claim. Both arguments are required; it cannot return a function to call later. Added in v0.3.0
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
vmap(f, xs) | f matrix, vector, or scalarnot documented yetxs matrix, vector, or scalarnot documented yet | not documented yet | This is a batched loop written in Rust, not a vectorizing transform: Qu is a tree-walking interpreter with no tracing JIT, so there is no batched kernel for a mapped function to compile into. It saves the per-iteration interpreter overhead of a Qu-level for loop, which is a constant factor, not an asymptotic win — reach for it for the result-stacking and the API shape, not for a speed claim. Both arguments are required; it cannot return a function to call later. Added in v0.3.0. |
Examples
No documentation example calls this form yet. The REPL & diagnostics chapter is where one belongs.