Class ReduceLeft<A>
- java.lang.Object
-
- com.jnape.palatable.lambda.functions.builtin.fn2.ReduceLeft<A>
-
- Type Parameters:
A- The input Iterable element type, as well as the accumulation type
- All Implemented Interfaces:
Fn1<Fn2<? super A,? super A,? extends A>,Fn1<java.lang.Iterable<A>,Maybe<A>>>,Fn2<Fn2<? super A,? super A,? extends A>,java.lang.Iterable<A>,Maybe<A>>,Applicative<Fn1<java.lang.Iterable<A>,Maybe<A>>,Fn1<Fn2<? super A,? super A,? extends A>,?>>,Cartesian<Fn2<? super A,? super A,? extends A>,Fn1<java.lang.Iterable<A>,Maybe<A>>,Fn1<?,?>>,Cocartesian<Fn2<? super A,? super A,? extends A>,Fn1<java.lang.Iterable<A>,Maybe<A>>,Fn1<?,?>>,Contravariant<Fn2<? super A,? super A,? extends A>,Profunctor<?,Fn1<java.lang.Iterable<A>,Maybe<A>>,Fn1<?,?>>>,Functor<Fn1<java.lang.Iterable<A>,Maybe<A>>,Fn1<Fn2<? super A,? super A,? extends A>,?>>,Profunctor<Fn2<? super A,? super A,? extends A>,Fn1<java.lang.Iterable<A>,Maybe<A>>,Fn1<?,?>>,Monad<Fn1<java.lang.Iterable<A>,Maybe<A>>,Fn1<Fn2<? super A,? super A,? extends A>,?>>,MonadReader<Fn2<? super A,? super A,? extends A>,Fn1<java.lang.Iterable<A>,Maybe<A>>,Fn1<Fn2<? super A,? super A,? extends A>,?>>,MonadRec<Fn1<java.lang.Iterable<A>,Maybe<A>>,Fn1<Fn2<? super A,? super A,? extends A>,?>>,MonadWriter<Fn2<? super A,? super A,? extends A>,Fn1<java.lang.Iterable<A>,Maybe<A>>,Fn1<Fn2<? super A,? super A,? extends A>,?>>
public final class ReduceLeft<A> extends java.lang.Object implements Fn2<Fn2<? super A,? super A,? extends A>,java.lang.Iterable<A>,Maybe<A>>
Given anand aIterable<A>, iteratively accumulate over theFn2<A, A, A>Iterable, returning. If theMaybe<A>Iterableis empty, the result isMaybe.nothing(); otherwise, the result is wrapped inMaybe.just(A). For this reason,nullaccumulation results are considered erroneous and will throw.This function is isomorphic to a left fold over the
Iterablewhere the head element is the starting accumulation value and the result is lifted intoMaybe.- See Also:
ReduceRight,FoldLeft
-
-
Field Summary
Fields Modifier and Type Field Description private static ReduceLeft<?>INSTANCE
-
Constructor Summary
Constructors Modifier Constructor Description privateReduceLeft()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Maybe<A>checkedApply(Fn2<? super A,? super A,? extends A> fn, java.lang.Iterable<A> as)static <A> ReduceLeft<A>reduceLeft()static <A> Fn1<java.lang.Iterable<A>,Maybe<A>>reduceLeft(Fn2<? super A,? super A,? extends A> fn)static <A> Maybe<A>reduceLeft(Fn2<? super A,? super A,? extends A> fn, java.lang.Iterable<A> as)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.jnape.palatable.lambda.functions.Fn1
andThen, carry, cartesian, censor, choose, cocartesian, diMap, diMapR, discardL, flatMap, fmap, lazyZip, listens, local, pure, self, thunk, toFunction, trampolineM, zip, zip
-
-
-
-
Field Detail
-
INSTANCE
private static final ReduceLeft<?> INSTANCE
-
-
Method Detail
-
checkedApply
public Maybe<A> checkedApply(Fn2<? super A,? super A,? extends A> fn, java.lang.Iterable<A> as)
-
reduceLeft
public static <A> ReduceLeft<A> reduceLeft()
-
reduceLeft
public static <A> Fn1<java.lang.Iterable<A>,Maybe<A>> reduceLeft(Fn2<? super A,? super A,? extends A> fn)
-
-