Class F<A,​B>

  • Type Parameters:
    A - The input type.
    B - The output type.
    All Implemented Interfaces:
    Function<A,​B>
    Direct Known Subclasses:
    F.Constant

    public abstract class F<A,​B>
    extends java.lang.Object
    implements Function<A,​B>
    A type for a function from A -> B.
    Author:
    Alex Kalderimis
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  F.Constant<X,​R>
      An implementation of a constant function.
    • Constructor Summary

      Constructors 
      Constructor Description
      F()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract B call​(A a)
      The body of the function
      <C> F<A,​C> compose​(F<B,​C> outer)
      Compose two functions f and g producing a function h such that h(x) = f(g(x)).
      static <B> F<java.lang.Object,​B> constant​(B val)
      Construct a constant function that discards its input and always returns the same value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • F

        public F()
    • Method Detail

      • call

        public abstract B call​(A a)
        The body of the function
        Specified by:
        call in interface Function<A,​B>
        Parameters:
        a - The parameter.
        Returns:
        Something.
      • constant

        public static <B> F<java.lang.Object,​B> constant​(B val)
        Construct a constant function that discards its input and always returns the same value.
        Type Parameters:
        B - The type of the thing.
        Parameters:
        val - The thing to return.
        Returns:
        That same thing.
      • compose

        public <C> F<A,​C> compose​(F<B,​C> outer)
        Compose two functions f and g producing a function h such that h(x) = f(g(x)).
        Type Parameters:
        C - The type of the final result.
        Parameters:
        outer - The outer function, which consumes the result of this function.
        Returns:
        The result of applying this function to the result of that function.