Class Find


  • public class Find
    extends PrimitiveFunction
    Finds the first element in a list that satisfies the predicate.
    • Constructor Summary

      Constructors 
      Constructor Description
      Find()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <X> Maybe<X> apply​(java.util.function.Function<X,​java.lang.Boolean> pred, ConsList<X> lst)
      Finds the first element in a list that satisfies the predicate.
      static <X> java.util.function.Function<ConsList<X>,​Maybe<X>> apply​(java.util.function.Predicate<X> pred)
      Finds the first element in a list that satisfies the predicate.
      static <X> Maybe<X> apply​(java.util.function.Predicate<X> pred, ConsList<X> lst)
      Finds the first element in a list that satisfies the predicate.
      protected java.util.function.Function<java.util.List<Term>,​java.util.function.Function<Context,​java.util.function.Function<Graph,​Either<InContext<Error_>,​Term>>>> implementation()
      A dynamic/interpreted implementation of the function.
      Name name()
      The unique name of the primitive function.
      TypeScheme type()
      The datatype of the primitive function.
      • Methods inherited from class java.lang.Object

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

      • Find

        public Find()
    • 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<Context,​java.util.function.Function<Graph,​Either<InContext<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> java.util.function.Function<ConsList<X>,​Maybe<X>> apply​(java.util.function.Predicate<X> pred)
        Finds the first element in a list that satisfies the predicate.
        Type Parameters:
        X - the element type
        Parameters:
        pred - the predicate to test elements
        Returns:
        a function that finds the first matching element
      • apply

        public static <X> Maybe<X> apply​(java.util.function.Function<X,​java.lang.Boolean> pred,
                                         ConsList<X> lst)
        Finds the first element in a list that satisfies the predicate.
        Type Parameters:
        X - the element type
        Parameters:
        pred - the predicate as a Function (used by generated code)
        lst - the list to search
        Returns:
        an optional containing the first matching element, or empty if none found
      • apply

        public static <X> Maybe<X> apply​(java.util.function.Predicate<X> pred,
                                         ConsList<X> lst)
        Finds the first element in a list that satisfies the predicate.
        Type Parameters:
        X - the element type
        Parameters:
        pred - the predicate to test elements
        lst - the list to search
        Returns:
        an optional containing the first matching element, or empty if none found