compile_closure

Synopsis

& compile_closure("code", ...)

Creates a new Sleep closure from the specified string of Sleep code.

Parameters

"code" - a string containing the statements of the function.

... - a series of key/value pairs to be installed into the closure environment.

Returns

The closure built from compiling the specified code.

Errors

Examples

$foo = compile_closure('return $1 * $x;', $x => 5); println("\$foo is $foo"); println('[$foo: 2] - ' . [$foo: 2]); println('[$foo: 8] - ' . [$foo: 8]); println('[$foo: 4.3] - ' . [$foo: 4.3]);

$foo is &closure[eval:0]#73 [$foo: 2] - 10 [$foo: 8] - 40 [$foo: 4.3] - 21.5

See Also