Beispiel #1
0
 public static <A, B> Result<List<B>> traverse(List<A> list, Function<A, Result<B>> f) {
   return list.foldRight(
       Result.success(List.list()), x -> y -> Result.map2(f.apply(x), y, a -> b -> b.cons(a)));
 }
Beispiel #2
0
 public static <A, B> B foldRight(List<A> list, B n, Function<A, Function<B, B>> f) {
   return list.foldRight(n, f);
 }