Next: , Previous: , Up: Functions   [Contents][Index]


14.12.6 Lambdas

Poke support lambda expressions using the following syntax:

lambda function_specifier

Where function_specifier is any function specifier. Examples:

lambda void: {}
lambda (int i) int: { return i * 2; }

Lambdas can be manipulated exactly like any other Poke value, and can be stored in variables. Therefore, this is an alternative way of defining a named function (which can’t be recursive for obvious reasons):

var double = lambda (int i) int: { return i * 2 };