Package hydra.lib.lists
Class Find
java.lang.Object
hydra.tools.PrimitiveFunction
hydra.lib.lists.Find
Finds the first element in a list that satisfies the predicate.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <X> Maybe<X>Finds the first element in a list that satisfies the predicate.Finds the first element in a list that satisfies the predicate.static <X> Maybe<X>Finds the first element in a list that satisfies the predicate.A dynamic/interpreted implementation of the function.name()The unique name of the primitive function.type()The datatype of the primitive function.Methods inherited from class hydra.tools.PrimitiveFunction
term, toNative
-
Constructor Details
-
Find
public Find()
-
-
Method Details
-
name
Description copied from class:PrimitiveFunctionThe unique name of the primitive function.- Specified by:
namein classPrimitiveFunction- Returns:
- the name of this primitive function
-
type
Description copied from class:PrimitiveFunctionThe datatype of the primitive function.- Specified by:
typein classPrimitiveFunction- Returns:
- the type scheme of this primitive function
-
implementation
Description copied from class:PrimitiveFunctionA dynamic/interpreted implementation of the function.- Specified by:
implementationin classPrimitiveFunction- Returns:
- the function implementation
-
apply
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
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
Finds the first element in a list that satisfies the predicate.- Type Parameters:
X- the element type- Parameters:
pred- the predicate to test elementslst- the list to search- Returns:
- an optional containing the first matching element, or empty if none found
-