iterateWhile<U> static method
Apply Op on previous state of base while predicate pass then return all results
Implementation
@useResult
static IList<U> iterateWhile<U>(U base, Predicate<U> test, Op<U> op) {
final l = <U>[];
U acc = base;
l.add(acc);
while (test(acc)) {
acc = op(l.last);
l.add(acc);
}
return l.lock;
}