def grow_until

bend-collections@1.0.0.0 · src/containers/dynamic_array.bend:156

import bend-collections@1.0.0.0/src/containers/dynamic_array.bend as DynamicArray
import 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))

Uses (3)

Used by (1)