Skip to content

Default the reflection nodes to 1:R instead of a nothing sentinel - #10

Merged
pbelmans merged 1 commit into
mainfrom
nodes-range
Aug 13, 2026
Merged

Default the reflection nodes to 1:R instead of a nothing sentinel#10
pbelmans merged 1 commit into
mainfrom
nodes-range

Conversation

@pbelmans

@pbelmans pbelmans commented Aug 13, 2026

Copy link
Copy Markdown
Member

Follow-up to #8, on top of the now-merged #9.

#8 spelled "reflect in every node" as nodes === nothing, which then had to be understood in five places. Defaulting to 1:R deletes the sentinel: the kernel test drops from nodes === nothing || s in nodes to s in nodes, and something(nodes, 1:R) disappears from is_singular and _borel_weil_bott.

Dispatch was the alternative, but both cases run the same algorithm and differ only in a predicate, so it would duplicate the fold loop — and the singleton type that avoids the duplication is Base.OneTo reinvented.

Measured, 2000 E₈ weights: 0.3135–0.3142 ms against 0.3141–0.3284 for the sentinel and 0.3145 before #8. Base.OneTo(R) and 1:R benchmark identically in-process, so 1:R wins for reading. Validation stays free: the compiler drops the check loop on the default, where the induction variable is provably in bounds.

Suite, doctests and benchmark/bench.jl green. Node-argument tests 33 → 40, covering out-of-range ranges and empty ones whose endpoints are out of range (9:1).

@pbelmans
pbelmans changed the base branch from bwb-internal to main August 13, 2026 07:28
@pbelmans
pbelmans merged commit 7a38b4e into main Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant