Node:Closures, Next:Subrs, Previous:Procedures, Up:Non-immediate Datatypes
[FIXME: this needs to be further subbed, but texinfo has no subsubsub]
A closure is a procedure object, generated as the value of a
lambda
expression in Scheme. The representation of a closure is
straightforward -- it contains a pointer to the code of the lambda
expression from which it was created, and a pointer to the environment
it closes over.
In Guile, each closure also has a property list, allowing the system to store information about the closure. I'm not sure what this is used for at the moment -- the debugger, maybe?
int SCM_CLOSUREP (SCM x) | Macro |
Return non-zero iff x is a closure. |
SCM SCM_PROCPROPS (SCM x) | Macro |
Return the property list of the closure x. The results are undefined if x is not a closure. |
void SCM_SETPROCPROPS (SCM x, SCM p) | Macro |
Set the property list of the closure x to p. The results are undefined if x is not a closure. |
SCM SCM_CODE (SCM x) | Macro |
Return the code of the closure x. The result is undefined if
x is not a closure.
This function should probably only be used internally by the interpreter, since the representation of the code is intimately connected with the interpreter's implementation. |
SCM SCM_ENV (SCM x) | Macro |
Return the environment enclosed by x.
The result is undefined if x is not a closure.
This function should probably only be used internally by the interpreter, since the representation of the environment is intimately connected with the interpreter's implementation. |