// f : func -> A // pred: func(A) -> bool static O repeatUntilMatches(O f, O pred, int timeOut) { long time = sysNow(); while (!timedOut(time, timeOut)) { O a = callF(f); if (isTrue(callF(pred, a))) ret a; } null; }