builtins: add flatmap fn xs (tree-only HOF)#189
Merged
Conversation
3263474 to
4aa6951
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
1d3b919 to
13e688e
Compare
map followed by flat was a frequent two-token pattern. flatmap fuses them into one and is the natural shape for fan-out transforms where each input element produces zero or more output elements. Tree-only HOF: the verifier enforces a function literal in the fn position, the interpreter walks it directly. No new opcode for the JIT - the tree interpreter handles it.
13e688e to
4bc93e7
Compare
Mirrors the uniqby coverage so a future refactor that drops the flatmap verify arm gets caught on the VM dispatch path too.
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.
map then flat was a frequent two-token pattern. flatmap fuses them into the natural shape for fan-out transforms where each input element produces zero or more outputs.
Implementation:
Tests: cross-engine regression tests + examples/flatmap.ilo with -- run: directives.