Journal.recover.go: def of bend-kit-journal@0.3.1.0
Import: import bend-kit-journal@0.3.1.0/journal.bend as Journal
Lines 112-131 of bend-kit-journal@0.3.1.0/journal.bend: https://jend.leeeet.dev/read.txt?path=bend-kit-journal@0.3.1.0/journal.bend&start_line=112&end_line=131
import Base
# Every frame from st on. Once n frames are taken, the next one is the last: the tail is Corrupt,
# and rest starts after it. Callers give n at least the frame count, so this never happens.
def recover.go(~a: Quant, ~P: Kind(a), ~S: Type, ~fits: S -> @+at:U32 -> @+n:U32 -> S & Bool, ~u32: S -> @+at:U32 -> S & U32, ~cut: S -> @+hs:U32 -> @+len:U32 -> S & P, ~skip: S -> @+hs:U32 -> @+len:U32 -> S, ~sum: P -> P & U32, n: Nat, +max: U32, st: Step
) -> Recovery:
match n st:
case 0n End{s}:
Recovery{Nil{}, Clean{}, s}
case 0n Short{s}:
Recovery{Nil{}, Torn{}, s}
case 0n Bad{why, s}:
Recovery{Nil{}, Corrupt{why}, s}
case 0n Got{p, s}:
Recovery{Con{p, Nil{}}, Corrupt{"frame budget exhausted"}, s}
case 1n+m End{s}:
Recovery{Nil{}, Clean{}, s}
case 1n+m Short{s}:
Recovery{Nil{}, Torn{}, s}
case 1n+m Bad{why, s}:
Recovery{Nil{}, Corrupt{why}, s}
case 1n+m Got{p, s}:
recover.con(~a, ~P, ~S, p, recover.go(~a, ~P, ~S, ~fits, ~u32, ~cut, ~skip, ~sum, m, max, next(~P, ~S, ~fits, ~u32, ~cut, ~skip, ~sum, max, s)))
Uses (10):
https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool
https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List
https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat
https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair
https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32
https://jend.leeeet.dev/definition.txt?path=bend-kit-journal@0.3.1.0/journal.bend&name=Recovery
https://jend.leeeet.dev/definition.txt?path=bend-kit-journal@0.3.1.0/journal.bend&name=Step
https://jend.leeeet.dev/definition.txt?path=bend-kit-journal@0.3.1.0/journal.bend&name=Tail
https://jend.leeeet.dev/definition.txt?path=bend-kit-journal@0.3.1.0/journal.bend&name=next
https://jend.leeeet.dev/definition.txt?path=bend-kit-journal@0.3.1.0/journal.bend&name=recover.con