Class Function
java.lang.Object
fj.Function
Transformations on functions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionandThen()Function composition flipped.static <A,B, C> F <A, C> Function composition flipped.apply(A a) Function application with the arguments flipped.static <A,B, C> F <C, B> Performs function application within a higher-order function (applicative functor pattern).static <A,B, C> F <C, B> Performs function application within a higher-order function (applicative functor pattern).static <A,B, C> F <C, B> Binds the function in the second argument to the function in the first argument.static <A,B, C, D> F <D, C> Binds the given function f to the values of the given functions, with a final join.compose()Function composition.static <A,B, C> F <A, C> Function composition.Function composition.constant()Returns a function that given an argument, returns a function that ignores its argument.static <A,B> F <A, B> constant(B b) Returns a function that ignores its argument to constantly produce the given value.Curry a function of arity-2.static <A,B, C> F <B, C> Curry a function of arity-2.Curry a function of arity-3.Curry a function of arity-3.static <A,B, C, D> F <C, D> Curry a function of arity-3.Curry a function of arity-4.Curry a function of arity-4.Curry a function of arity-4.static <A,B, C, D, E>
F<D, E> Curry a function of arity-4.Curry a function of arity-5.Curry a function of arity-5.Curry a function of arity-5.Curry a function of arity-5.static <A,B, C, D, E, F$>
F<E, F$> Curry a function of arity-5.Curry a function of arity-6.Curry a function of arity-7.Curry a function of arity-7.Curry a function of arity-7.Curry a function of arity-7.Curry a function of arity-7.Curry a function of arity-7.static <A,B, C, D, E, F$, G, H>
F<G, H> Curry a function of arity-7.Curry a function of arity-8.Curry a function of arity-8.Curry a function of arity-8.Curry a function of arity-8.Curry a function of arity-8.Curry a function of arity-8.Curry a function of arity-8.static <A,B, C, D, E, F$, G, H, I>
F<H, I> Curry a function of arity-7.flip()Function argument flipping.Function argument flipping.static <A,B, C> F2 <B, A, C> Function argument flipping.flip2()Function argument flipping.static <A> F<A, A> identity()The identity transformation.static <A,B> F <B, A> Joins two arguments of a function of arity-2 into one argument, yielding a function of arity-1.Promotes a function of arity-2 to a higher-order function.Return a function that inspects the argument of the given function for anullvalue and if so, does not apply the value, instead returning an empty optional value.Applies a given function over the arguments of another function of arity-2.static <A,B, C> F <A, C> partialApply2(F<A, F<B, C>> f, B b) Partial application of the second argument to the supplied function to get a function of typeA -> C.partialApply3(F<A, F<B, F<C, D>>> f, C c) Partial application of the third argument to the supplied function to get a function of typeA -> B -> D.partialApply4(F<A, F<B, F<C, F<D, E>>>> f, D d) Partial application of the fourth argument to the supplied function to get a function of typeA -> B -> C -> E.Partial application of the fifth argument to the supplied function to get a function of typeA -> B -> C -> D -> F$.Partial application of the sixth argument to the supplied function to get a function of typeA -> B -> C -> D -> E -> G.Partial application of the seventh argument to the supplied function to get a function of typeA -> B -> C -> D -> E -> F$ -> H.Partial application of the eigth argument to the supplied function to get a function of typeA -> B -> C -> D -> E -> F$ -> G -> I.Uncurry a function of arity-2.static <A,B, C> F2 <A, B, C> Uncurry a function of arity-2.Uncurry a function of arity-3.static <A,B, C, D> F3 <A, B, C, D> Uncurry a function of arity-3.Uncurry a function of arity-4.static <A,B, C, D, E>
F4<A, B, C, D, E> Uncurry a function of arity-4.Uncurry a function of arity-5.static <A,B, C, D, E, F$>
F5<A, B, C, D, E, F$> Uncurry a function of arity-6.Uncurry a function of arity-6.static <A,B, C, D, E, F$, G>
F6<A, B, C, D, E, F$, G> Uncurry a function of arity-6.Uncurry a function of arity-7.static <A,B, C, D, E, F$, G, H>
F7<A, B, C, D, E, F$, G, H> Uncurry a function of arity-7.static <A,B, C, D, E, F$, G, H, I>
F<F<A, F<B, F<C, F<D, F<E, F<F$, F<G, F<H, I>>>>>>>>, F8<A, B, C, D, E, F$, G, H, I>> Uncurry a function of arity-8.static <A,B, C, D, E, F$, G, H, I>
F8<A, B, C, D, E, F$, G, H, I> Uncurry a function of arity-8.vary()Simultaneously covaries and contravaries a function.static <A,B> F <A, B> Simultaneously covaries and contravaries a function.
-
Constructor Details
-
Function
private Function()
-
-
Method Details
-
apply
-
compose
-
compose
-
compose2
-
andThen
-
andThen
-
identity
The identity transformation.- Returns:
- The identity transformation.
-
constant
-
constant
Returns a function that ignores its argument to constantly produce the given value.- Parameters:
b- The value to return when the returned function is applied.- Returns:
- A function that ignores its argument to constantly produce the given value.
-
vary
-
vary
-
flip
-
flip
-
flip
-
flip2
-
nullable
Return a function that inspects the argument of the given function for anullvalue and if so, does not apply the value, instead returning an empty optional value.- Parameters:
f- The function to check for anullargument.- Returns:
- A function that inspects the argument of the given function for a
nullvalue and if so, does not apply the value, instead returning an empty optional value.
-
curry
-
curry
-
uncurryF2
-
uncurryF2
-
curry
-
curry
-
curry
-
uncurryF3
-
uncurryF3
-
curry
-
curry
-
curry
-
curry
Curry a function of arity-4.- Parameters:
f- The function to curry.a- An argument to the curried function.b- An argument to the curried function.c- An argument to the curried function.- Returns:
- A curried form of the given function.
-
uncurryF4
-
uncurryF4
-
curry
-
curry
-
curry
-
curry
Curry a function of arity-5.- Parameters:
f- The function to curry.a- An argument to the curried function.b- An argument to the curried function.c- An argument to the curried function.- Returns:
- A curried form of the given function.
-
curry
Curry a function of arity-5.- Parameters:
f- The function to curry.a- An argument to the curried function.b- An argument to the curried function.c- An argument to the curried function.d- An argument to the curried function.- Returns:
- A curried form of the given function.
-
uncurryF5
-
uncurryF5
-
curry
-
uncurryF6
-
uncurryF6
-
curry
-
curry
-
curry
public static <A,B, F<C, F<D, F<E, F<F$,C, D, E, F$, G, H> F<G, curryH>>>>> (F7<A, B, C, D, E, F$, G, H> f, A a, B b) Curry a function of arity-7.- Parameters:
f- The function to curry.a- An argument to the curried function.b- An argument to the curried function.- Returns:
- A curried form of the given function.
-
curry
public static <A,B, F<D, F<E, F<F$,C, D, E, F$, G, H> F<G, curryH>>>> (F7<A, B, C, D, E, F$, G, H> f, A a, B b, C c) Curry a function of arity-7.- Parameters:
f- The function to curry.a- An argument to the curried function.b- An argument to the curried function.c- An argument to the curried function.- Returns:
- A curried form of the given function.
-
curry
public static <A,B, F<E, F<F$,C, D, E, F$, G, H> F<G, curryH>>> (F7<A, B, C, D, E, F$, G, H> f, A a, B b, C c, D d) Curry a function of arity-7.- Parameters:
f- The function to curry.a- An argument to the curried function.b- An argument to the curried function.c- An argument to the curried function.d- An argument to the curried function.- Returns:
- A curried form of the given function.
-
curry
public static <A,B, F<F$,C, D, E, F$, G, H> F<G, curryH>> (F7<A, B, C, D, E, F$, G, H> f, A a, B b, C c, D d, E e) Curry a function of arity-7.- Parameters:
f- The function to curry.a- An argument to the curried function.b- An argument to the curried function.c- An argument to the curried function.d- An argument to the curried function.e- An argument to the curried function.- Returns:
- A curried form of the given function.
-
curry
public static <A,B, F<G,C, D, E, F$, G, H> H> curry(F7<A, B, C, D, E, F$, G, H> f, A a, B b, C c, D d, E e, F$ f$) Curry a function of arity-7.- Parameters:
f- The function to curry.a- An argument to the curried function.b- An argument to the curried function.c- An argument to the curried function.d- An argument to the curried function.e- An argument to the curried function.f$- An argument to the curried function.- Returns:
- A curried form of the given function.
-
uncurryF7
-
uncurryF7
-
curry
-
curry
-
curry
public static <A,B, F<C, F<D, F<E, F<F$, F<G,C, D, E, F$, G, H, I> F<H, curryI>>>>>> (F8<A, B, C, D, E, F$, G, H, I> f, A a, B b) Curry a function of arity-8.- Parameters:
f- The function to curry.a- An argument to the curried function.b- An argument to the curried function.- Returns:
- A curried form of the given function.
-
curry
public static <A,B, F<D, F<E, F<F$, F<G,C, D, E, F$, G, H, I> F<H, curryI>>>>> (F8<A, B, C, D, E, F$, G, H, I> f, A a, B b, C c) Curry a function of arity-8.- Parameters:
f- The function to curry.a- An argument to the curried function.b- An argument to the curried function.c- An argument to the curried function.- Returns:
- A curried form of the given function.
-
curry
public static <A,B, F<E, F<F$, F<G,C, D, E, F$, G, H, I> F<H, curryI>>>> (F8<A, B, C, D, E, F$, G, H, I> f, A a, B b, C c, D d) Curry a function of arity-8.- Parameters:
f- The function to curry.a- An argument to the curried function.b- An argument to the curried function.c- An argument to the curried function.d- An argument to the curried function.- Returns:
- A curried form of the given function.
-
curry
public static <A,B, F<F$, F<G,C, D, E, F$, G, H, I> F<H, curryI>>> (F8<A, B, C, D, E, F$, G, H, I> f, A a, B b, C c, D d, E e) Curry a function of arity-8.- Parameters:
f- The function to curry.a- An argument to the curried function.b- An argument to the curried function.c- An argument to the curried function.d- An argument to the curried function.e- An argument to the curried function.- Returns:
- A curried form of the given function.
-
curry
public static <A,B, F<G,C, D, E, F$, G, H, I> F<H, curryI>> (F8<A, B, C, D, E, F$, G, H, I> f, A a, B b, C c, D d, E e, F$ f$) Curry a function of arity-8.- Parameters:
f- The function to curry.a- An argument to the curried function.b- An argument to the curried function.c- An argument to the curried function.d- An argument to the curried function.e- An argument to the curried function.f$- An argument to the curried function.- Returns:
- A curried form of the given function.
-
curry
public static <A,B, F<H,C, D, E, F$, G, H, I> I> curry(F8<A, B, C, D, E, F$, G, H, I> f, A a, B b, C c, D d, E e, F$ f$, G g) Curry a function of arity-7.- Parameters:
f- The function to curry.a- An argument to the curried function.b- An argument to the curried function.c- An argument to the curried function.d- An argument to the curried function.e- An argument to the curried function.f$- An argument to the curried function.g- An argument to the curried function.- Returns:
- A curried form of the given function.
-
uncurryF8
-
uncurryF8
-
bind
Binds the function in the second argument to the function in the first argument.- Parameters:
ma- A function whose argument type is the same as the argument type of the return value.f- A function whose argument type is the same as the return type of ma, and yields the return value.- Returns:
- A function that chains the given functions together such that the result of applying ma to the argument is given to f, yielding a function that is applied to the argument again.
-
apply
Performs function application within a higher-order function (applicative functor pattern).- Parameters:
cab- The higher-order function to apply a function to.ca- A function to apply within a higher-order function.- Returns:
- A new function after applying the given higher-order function to the given function.
-
apply
Performs function application within a higher-order function (applicative functor pattern).- Parameters:
cab- The higher-order function to apply a function to.ca- A function to apply within a higher-order function.- Returns:
- A new function after applying the given higher-order function to the given function.
-
bind
Binds the given function f to the values of the given functions, with a final join.- Parameters:
ca- A function to bind f function to.cb- A function to bind f function to.f- The bound function to be composed with ca and then applied with cb- Returns:
- A new function after performing the composition, then application.
-
on
Applies a given function over the arguments of another function of arity-2.- Parameters:
a- The function whose arguments to apply another function over.f- The function to apply over the arguments of another function.- Returns:
- A function whose arguments are fed through function f, before being passed to function a.
-
lift
-
join
-
partialApply2
Partial application of the second argument to the supplied function to get a function of typeA -> C. Same asflip(f).f(b).- Parameters:
f- The function to partially apply.b- The value to apply to the function.- Returns:
- A new function based on
fwith its second argument applied.
-
partialApply3
Partial application of the third argument to the supplied function to get a function of typeA -> B -> D.- Parameters:
f- The function to partially apply.c- The value to apply to the function.- Returns:
- A new function based on
fwith its third argument applied.
-
partialApply4
Partial application of the fourth argument to the supplied function to get a function of typeA -> B -> C -> E.- Parameters:
f- The function to partially apply.d- The value to apply to the function.- Returns:
- A new function based on
fwith its fourth argument applied.
-
partialApply5
public static <A,B, F<A, F<B, F<C,C, D, E, F$> F<D, partialApply5F$>>>> (F<A, F<B, F<C, F<D, F<E, F$>>>>> f, E e) Partial application of the fifth argument to the supplied function to get a function of typeA -> B -> C -> D -> F$.- Parameters:
f- The function to partially apply.e- The value to apply to the function.- Returns:
- A new function based on
fwith its fifth argument applied.
-
partialApply6
public static <A,B, F<A, F<B, F<C, F<D,C, D, E, F$, G> F<E, partialApply6G>>>>> (F<A, F<B, F<C, F<D, F<E, F<F$, G>>>>>> f, F$ f$) Partial application of the sixth argument to the supplied function to get a function of typeA -> B -> C -> D -> E -> G.- Parameters:
f- The function to partially apply.f$- The value to apply to the function.- Returns:
- A new function based on
fwith its sixth argument applied.
-
partialApply7
public static <A,B, F<A, F<B, F<C, F<D, F<E,C, D, E, F$, G, H> F<F$, partialApply7H>>>>>> (F<A, F<B, F<C, F<D, F<E, F<F$, F<G, H>>>>>>> f, G g) Partial application of the seventh argument to the supplied function to get a function of typeA -> B -> C -> D -> E -> F$ -> H.- Parameters:
f- The function to partially apply.g- The value to apply to the function.- Returns:
- A new function based on
fwith its seventh argument applied.
-
partialApply8
public static <A,B, F<A, F<B, F<C, F<D, F<E, F<F$,C, D, E, F$, G, H, I> F<G, partialApply8I>>>>>>> (F<A, F<B, F<C, F<D, F<E, F<F$, F<G, F<H, I>>>>>>>> f, H h) Partial application of the eigth argument to the supplied function to get a function of typeA -> B -> C -> D -> E -> F$ -> G -> I.- Parameters:
f- The function to partially apply.h- The value to apply to the function.- Returns:
- A new function based on
fwith its eigth argument applied.
-