Class Closure

java.lang.Object
  extended by Closure
All Implemented Interfaces:
Function

public class Closure
extends java.lang.Object
implements Function

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
 java.lang.Object apply(java.lang.Object argument)
          Apply this function to a specified argument value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 java.lang.Object apply(java.lang.Object argument)
Description copied from interface: Function
Apply this function to a specified argument value.

Specified by:
apply in interface Function
Parameters:
argument - the argument value
Returns:
the result value from the function application.