Class Times<A>

java.lang.Object
com.jnape.palatable.lambda.functions.builtin.fn3.Times<A>
Type Parameters:
A - the input and output type
All Implemented Interfaces:
Fn1<Integer, Fn1<Fn1<? super A, ? extends A>, Fn1<A,A>>>, Fn2<Integer, Fn1<? super A, ? extends A>, Fn1<A,A>>, Fn3<Integer, Fn1<? super A, ? extends A>, A, A>, Applicative<Fn1<Fn1<? super A, ? extends A>, Fn1<A,A>>, Fn1<Integer,?>>, Cartesian<Integer, Fn1<Fn1<? super A, ? extends A>, Fn1<A,A>>, Fn1<?,?>>, Cocartesian<Integer, Fn1<Fn1<? super A, ? extends A>, Fn1<A,A>>, Fn1<?,?>>, Contravariant<Integer, Profunctor<?, Fn1<Fn1<? super A, ? extends A>, Fn1<A,A>>, Fn1<?,?>>>, Functor<Fn1<Fn1<? super A, ? extends A>, Fn1<A,A>>, Fn1<Integer,?>>, Profunctor<Integer, Fn1<Fn1<? super A, ? extends A>, Fn1<A,A>>, Fn1<?,?>>, Monad<Fn1<Fn1<? super A, ? extends A>, Fn1<A,A>>, Fn1<Integer,?>>, MonadReader<Integer, Fn1<Fn1<? super A, ? extends A>, Fn1<A,A>>, Fn1<Integer,?>>, MonadRec<Fn1<Fn1<? super A, ? extends A>, Fn1<A,A>>, Fn1<Integer,?>>, MonadWriter<Integer, Fn1<Fn1<? super A, ? extends A>, Fn1<A,A>>, Fn1<Integer,?>>

public final class Times<A> extends Object implements Fn3<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 Details

    • INSTANCE

      private static final Times<?> INSTANCE
  • Constructor Details

    • Times

      private Times()
  • Method Details

    • checkedApply

      public A checkedApply(Integer n, Fn1<? super A, ? extends A> fn, A a)
      Specified by:
      checkedApply in interface Fn3<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(Integer n)
    • times

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

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