traversal_loop.bend checks
raw source on the hub · import stelliferous@0.0.2.0/traversal_loop.bend as Traversal_loop
One sequential traversal for affine runtime owners and reusable proof states. The step is a compile-time template: no closure allocation in the loop.
1 import
import Base
Templates
template run source · line 5 · raw
@-State:Type -> @-step:(@_:State -> State) -> @count:Nat -> @state:State -> State
template run_then source · line 13 · raw
@-State:Type -> @-Result:Type -> @-step:(@_:State -> State) -> @-finish:(@_:State -> Result) -> @count:Nat -> @state:State -> Result
The same loop handing its final state to finish in the base case. A caller that stores its accumulators in finish keeps them out of the loop's return value, so an outlined loop never passes accumulators back by value.