feat: par-map builtin — general parallel fan-out (ILO-67)#610
Merged
Conversation
|
0a5950b to
c7df084
Compare
This was referenced May 22, 2026
Collaborator
Author
|
needs manual rebase (conflicts in: src/builtins.rs) |
Collaborator
Author
|
needs manual — rebase conflict in non-doc file(s) |
72aed01 to
176f358
Compare
Implements `par-map fn xs [n]` — a general concurrency primitive that applies a function to each element of a list in parallel, up to `n` items at a time (default: num_cpus; override via ILO_PAR_MAP_CONCURRENCY). Returns `L (R b t)`: per-item Ok/Err in input order without short-circuit. Tree-walker implementation using std::thread::scope with chunked batches, following the get-many pattern. VM/Cranelift bail to tree via the existing bridge (is_tree_bridge_eligible). Large handler extracted into #[inline(never)] par_map_run per the ILO-289 dispatch-arm-size convention. Touches: src/builtins.rs, src/interpreter/mod.rs, src/parser/mod.rs, src/verify.rs, src/vm/mod.rs, SPEC.md, ai.txt, skills/ilo/ilo-builtins-io.md, examples/par-map.ilo. Includes 3 interpreter tests. Closes ILO-67. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
aa92b2d to
8aea408
Compare
Collaborator
Author
|
mini pc is reviewing this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
par-map fn xs [n]builtin: applies a function to each list element in parallel, up tonitems at a time, returningL (R b t)in input ordernum_cpus; override withILO_PAR_MAP_CONCURRENCYenv varstd::thread::scope+ chunked batches (mirrorsget-many); VM/Cranelift route through the existing tree bridgeErrin the result list — no short-circuit, unlikemaprexamples/par-map.ilo, and 4 doc touchpoints updatedImplementation notes
par_map_runextracted as#[inline(never)]per ILO-289 dispatch-arm-size conventionEnvbuilt from a snapshot ofenv.functions+env.caps, so inner functions can use any builtin (including I/O / capability-checked builtins)map/flt)builtin_check_argsarm returnsL (R b t)from fn return type(Builtin::ParMap, 2) | (Builtin::ParMap, 3) => trueTest plan
cargo test --libpasses (3333 tests, 0 failures)cargo run -- run examples/par-map.ilo run-demooutputs[1, 4, 9, 16, 25, 36, 49, 64]then[2, 4, 6, 8, 10, 12, 14, 16]par-map sq [1 2 3] 2returns Ok-wrapped squared valuespar-map fn []returns[]Follow-up tickets (out of scope for v1)
par-map(currently bridges to tree)Closes ILO-67.
🤖 Generated with Claude Code