def grow_until
import bend-collections@1.0.0.0/src/containers/dynamic_array.bend as DynamicArrayimport Base
156# Doubles until n fits; `fuel` = limit - depth bounds the number of doublings.
157def grow_until(-T: Data, fuel: Nat, +n: Nat, st: DynArray<&2, T>) -> DynArray<&2, T>:
158 match fuel:
159 case 0n:
160 st
161 case 1n+f:
162 grow_until(T, f, n, grow_step(T, n, st))