Repository navigation
v4 std/node: add fold_node catamorphism - #3297
Merged
Merged
Conversation
briansrls
marked this pull request as ready for review
May 18, 2026 07:00
Contributor
Author
|
Verified the optional evaluation-order note against the current code. It is mechanically true that this |
This was referenced May 18, 2026
briansrls
added a commit
that referenced
this pull request
May 19, 2026
Adds NodeFold<R> + fold_node to 00_core.dag (v2.std.core) — the structural fold over a Node tree, mirroring src/v4/std/node.dag fold_node (#3297). expr_has_self_call was a hand-rolled any-descendant recursion over Node.children (Practice-10 walker dissolution); it is now derived as a fold_node disjunction. expr_has_non_tail_self_call stays a hand-written recursion — genuinely irregular (tail position flips per expr kind), a clean 🟢, not a catamorphism candidate. Verified: 00_core.dag parses, resolves, typechecks and emits with 0 diagnostics; fold_node's recursion passes the v2 complexity analyzer. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 19, 2026
briansrls
added a commit
that referenced
this pull request
May 22, 2026
…3564) Operator-direct prefix-drop sweep mirroring fold_node precedent (#3297) and the free_monoid_* sweep (#3472). Rename only — no semantics change. Touches the v4 algebra.dag definition + all v4.std.algebra imports/callsites in extdeps/formats/sql.dag and extdeps/languages/{cpp,python,rust}.dag, plus two 🟡-gated comment references in algebra.dag ("fold_list laundering"). v3 spec/std identifiers (`*_language_spec_free_monoid_fold_contract`) and archival narrative in docs/design-dissolution-lens.md are out of scope for a v4 substrate rename. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
NodeFold<R>algebra andfold_nodecatamorphism tosrc/v4/std/node.dagnode_well_formedonto the shared node fold instead of hand-rolled recursive descentValidation
cargo test -p v3-compiler v4_std_fact_density_dag_compiles -- --nocapturevia BuildBuddy