Lambda Functions

Lambda functions are values that correspond to a computation not yet performed. These can take arguments. Defining a lambda function returns the value that corresponds to the function itself, the eval computation must be used to obtain the value that the function computes.

DEFINITION

(lambda
   (([T0 = TYPE] {S0 = String}) ... ([TN = TYPE] {SN = String}))
   [COMPUTATION]
)

Returns a lambda function taking S0SN of types T0TN as arguments and evaluating to [COMPUTATION].

EVALUATION

(eval [LAMBDA O (C0 ... CN)] [C0 = COMPUTATION] ... [CN = COMPUTATION])

Returns the result of evaluating the lambda function at [REFERENCE] given the parameters C0CN.

PARTIAL EVALUATION

(partial [LAMBDA O (C0 ... CN)] [C0 = COMPUTATION] ... [CM = COMPUTATION])

Returns a lambda function corresponding to the [LAMBDA O (C0 ... CN)] in which the first M parameters have already been filled with C0CM.

Examples

(lambda ( (int i) )
   (+ (var i) 1)
)
(lambda ( (int i) )
   (* (eval int_to_int (var i)) 2)
)