Answers for "left fold java"

2

left fold java

# https://apocalisp.wordpress.com/2008/04/22/left-fold-in-java/
# now that there is lambdas in Java it's certainly easier but
# this one should stay with us for it is beautiful!
  
  public static <A, B> A fold(F<A, F<B, A>> f, A z, Iterable<B> xs)
    { A p = z;
      for (B x : xs)
        { p = f.f(p).f(x); }
      return p; }
Posted by: Guest on June-07-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language