Open bram209 opened 5 years ago
Would love a reduceUntil / reduceWhile method. What do you guys think?
Example:
type t('a, 'b) = | Continue('a) | Stop('b); let rec reduceUntil = (list, acc, f) => switch (list) { | [] => acc | [h, ...t] => switch(f(acc, h)) { | Stop(result) => result | Continue(acc) => reduce(t, acc, f) };
Would love a reduceUntil / reduceWhile method. What do you guys think?
Example: