Class MaybeInit


  • public class MaybeInit
    extends PrimitiveFunction
    Get all elements except the last, returning Nothing if the list is empty.
    • Constructor Detail

      • MaybeInit

        public MaybeInit()
    • Method Detail

      • name

        public Name name()
        Description copied from class: PrimitiveFunction
        The unique name of the primitive function.
        Specified by:
        name in class PrimitiveFunction
        Returns:
        the name of this primitive function
      • implementation

        protected java.util.function.Function<java.util.List<Term>,​java.util.function.Function<InferenceContext,​java.util.function.Function<Graph,​Either<Error_,​Term>>>> implementation()
        Description copied from class: PrimitiveFunction
        A dynamic/interpreted implementation of the function. Subclasses implement this with Either-based logic.
        Specified by:
        implementation in class PrimitiveFunction
        Returns:
        the function implementation
      • apply

        public static <X> Optional<java.util.List<X>> apply​(java.util.List<X> list)
        Apply the function to its single argument.
        Type Parameters:
        X - the element type
        Parameters:
        list - the list to get the init from
        Returns:
        a Optional containing all elements except the last, or empty if the list is empty