def prune
import bend-kit-retry@0.3.0.0/retry.bend as Retryimport Base
72# The failure times still inside the window: now < t + window. Newest first, so the first old time ends the list.
73def prune(+now: Nat, +window: Nat, fs: List<&2, Nat>) -> List<&2, Nat>:
74 match fs:
75 case Nil{}:
76 Nil{}
77 case Con{+t, rest}:
78 Bool.pick(List<&2, Nat>, Nat.is_lt(now, Nat.add(t, window)), Con{t, prune(now, window, rest)}, Nil{})