Class Times<A>

  • Type Parameters:
    A - the input and output type
    All Implemented Interfaces:
    Fn1<java.lang.Integer,​Fn1<Fn1<? super A,​? extends A>,​Fn1<A,​A>>>, Fn2<java.lang.Integer,​Fn1<? super A,​? extends A>,​Fn1<A,​A>>, Fn3<java.lang.Integer,​Fn1<? super A,​? extends A>,​A,​A>, Applicative<Fn1<Fn1<? super A,​? extends A>,​Fn1<A,​A>>,​Fn1<java.lang.Integer,​?>>, Cartesian<java.lang.Integer,​Fn1<Fn1<? super A,​? extends A>,​Fn1<A,​A>>,​Fn1<?,​?>>, Cocartesian<java.lang.Integer,​Fn1<Fn1<? super A,​? extends A>,​Fn1<A,​A>>,​Fn1<?,​?>>, Contravariant<java.lang.Integer,​Profunctor<?,​Fn1<Fn1<? super A,​? extends A>,​Fn1<A,​A>>,​Fn1<?,​?>>>, Functor<Fn1<Fn1<? super A,​? extends A>,​Fn1<A,​A>>,​Fn1<java.lang.Integer,​?>>, Profunctor<java.lang.Integer,​Fn1<Fn1<? super A,​? extends A>,​Fn1<A,​A>>,​Fn1<?,​?>>, Monad<Fn1<Fn1<? super A,​? extends A>,​Fn1<A,​A>>,​Fn1<java.lang.Integer,​?>>, MonadReader<java.lang.Integer,​Fn1<Fn1<? super A,​? extends A>,​Fn1<A,​A>>,​Fn1<java.lang.Integer,​?>>, MonadRec<Fn1<Fn1<? super A,​? extends A>,​Fn1<A,​A>>,​Fn1<java.lang.Integer,​?>>, MonadWriter<java.lang.Integer,​Fn1<Fn1<? super A,​? extends A>,​Fn1<A,​A>>,​Fn1<java.lang.Integer,​?>>

    public final class Times<A>
    extends java.lang.Object
    implements Fn3<java.lang.Integer,​Fn1<? super A,​? extends A>,​A,​A>
    Given some number of times n to invoke a function A -> A, and given an input A, iteratively apply the function to the input, and then to the result of the invocation, a total of n times, returning the result.

    Example: times(3, x -> x + 1, 0); // 3

    • Field Detail

      • INSTANCE

        private static final Times<?> INSTANCE
    • Constructor Detail

      • Times

        private Times()
    • Method Detail

      • checkedApply

        public A checkedApply​(java.lang.Integer n,
                              Fn1<? super A,​? extends A> fn,
                              A a)
        Specified by:
        checkedApply in interface Fn3<java.lang.Integer,​Fn1<? super A,​? extends A>,​A,​A>
      • times

        public static <A> Times<A> times()
      • times

        public static <A> Fn2<Fn1<? super A,​? extends A>,​A,​A> times​(java.lang.Integer n)
      • times

        public static <A> Fn1<A,​A> times​(java.lang.Integer n,
                                               Fn1<? super A,​? extends A> fn)
      • times

        public static <A> A times​(java.lang.Integer n,
                                  Fn1<? super A,​? extends A> fn,
                                  A a)