Class Closure
java.lang.Object
ValueBase
FunctionBase
Closure
- All Implemented Interfaces:
- Function, Value
public class Closure
- extends FunctionBase
A Closure is a function defined by code being interpreted (either a
function definition or a lambda expression), rather than being one
of the built-in functions such as +.
Method Summary |
Value |
apply(Value argument)
Apply this function to a specified argument Value. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface Value |
as |
Closure
public Closure(java.lang.String parameter,
Expression body,
Environment env)
- Creates a Closure with the specified components.
- Parameters:
parameter
- the name used in the function for its inputbody
- the expression evaluated when the function is usedenv
- the environment in which the function was created
apply
public Value apply(Value argument)
- Description copied from interface:
Function
- Apply this function to a specified argument Value.
- Parameters:
argument
- the argument Value
- Returns:
- the result Value from the function application.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object