def unroll.go
import yaml-for-bend@0.1.1.0/scan.bend as Scanimport Base
import yaml-for-bend@0.1.1.0/token.bend as T
613def unroll.go(inds: List<&2, Nat>, +ind: Nat, +lim: Nat, +at: T.Mark, +out: List<&2, T.Token>, +n: Nat) -> Lay:
614 match inds:
615 case Nil{}:
616 Lay{ind, [], out, n}
617 case Con{+h, +t}:
618 when(Lay, Nat.is_gt(ind, lim), u => unroll.go(t, h, lim, at, T.Token{T.BEnd{}, at, at} <> out, 1n+n), u => Lay{ind, h <> t, out, n})