Package hydra.lib.lists
Class SafeHead
java.lang.Object
hydra.tools.PrimitiveFunction
hydra.lib.lists.SafeHead
Safely returns the first element.
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class hydra.tools.PrimitiveFunction
term, toNative
-
Constructor Details
-
SafeHead
public SafeHead()
-
-
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
Apply the function to it single argument.- Type Parameters:
X- the element type- Parameters:
list- the list to get the head from- Returns:
- an optional containing the first element, or empty if the list is empty
-