feat(cli): 0.R4 - ludic deps sees through fn values (widest_reach) and lists the widest functions (--widest N, --reach N)
A step list or a registry of fn values takes no state and still reaches every state its steps take. The compiler now writes `reach <n> <function>` - every state a function can come to by a call, a `fn f` it writes or a global holding fn values it reads, to a fixed point - and ludic deps reports widest_reach beside widest_function, with how many of those states the function does not take (Maroon Lake: app_boot, 72, all 72 through fn values). --widest N lists the N functions that take the most states with what each reaches; --reach N orders them by reach. A baseline without widest_reach does not hold it until rewritten. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2eefae0618
commit
eb1e780733
8 changed files with 45622 additions and 42625 deletions
21
examples/state/reach.ludic
Normal file
21
examples/state/reach.ludic
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# ludic deps --reach: a step list takes no state and still reaches every state its steps take
|
||||
program Reach {
|
||||
state Alpha { n: int = 0 }
|
||||
state Beta { n: int = 0 }
|
||||
state Gamma { n: int = 0 }
|
||||
function step_a(a: mut Alpha) -> void { a.n += 1 }
|
||||
function step_b(b: mut Beta) -> void { b.n += 2 }
|
||||
function step_c(c: mut Gamma) -> void { c.n += 3 }
|
||||
let STEPS: []fn() -> void = [fn step_a, fn step_b]
|
||||
function run_steps() -> void {
|
||||
for i in 0 .. len(STEPS) { STEPS[i]() }
|
||||
}
|
||||
function one(c: mut Gamma) -> void {
|
||||
step_c(c)
|
||||
run_steps()
|
||||
}
|
||||
entry (c: mut Gamma) {
|
||||
one(c)
|
||||
print(`{c.n}`)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue