www.delorie.com/gnu/docs/guile/guile_73.html   search  
 
Buy GNU books!


Guile Reference Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

14.4 The Concept of Closure

The concept of closure is the idea that a lambda expression "captures" the variable bindings that are in lexical scope at the point where the lambda expression occurs. The procedure created by the lambda expression can refer to and mutate the captured bindings, and the values of those bindings persist between procedure calls.

This section explains and explores the various parts of this idea in more detail.

14.4.1 Names, Locations, Values and Environments  Names, locations, values and environments.
14.4.2 Local Variables and Environments  Local variables and local environments.
14.4.3 Environment Chaining  Environment chaining.
14.4.4 Lexical Scope  The meaning of lexical scoping.
14.4.5 Closure  Explaining the concept of closure.
14.4.6 Example 1: A Serial Number Generator  Example 1: a serial number generator.
14.4.7 Example 2: A Shared Persistent Variable  Example 2: a shared persistent variable.
14.4.8 Example 3: The Callback Closure Problem  Example 3: the callback closure problem.
14.4.9 Example 4: Object Orientation  Example 4: object orientation.


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003