Class Closure

java.lang.Object
  extended by ValueBase
      extended by FunctionBase
          extended by 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 +.


Constructor Summary
Closure(java.lang.String parameter, Expression body, Environment env)
          Creates a Closure with the specified components.
 
Method Summary
 Value apply(Value argument)
          Apply this function to a specified argument Value.
 java.lang.String toString()
           
 
Methods inherited from class ValueBase
as
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface Value
as
 

Constructor Detail

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 input
body - the expression evaluated when the function is used
env - the environment in which the function was created
Method Detail

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