Introduction#
Closure is a small library for the Ring programming language. A closure is a function together with variables that belong to it: each time you call it, it uses and changes its own copy of those variables, so it remembers the values between calls.
The library has three functions (closure(), invoke() and isClosure()) and one class (closureObject).
Features#
- Create a closure from an anonymous function and a list of the variables it keeps
- Capture the variables of the current function by name, or give them as
[name, value]pairs - Every closure has its own variables: two closures made by the same function do not share them
- Call a closure with
invoke(), and check a value withisClosure()
Where to go next#
- Getting started: install and the first closure.
- Samples: the program of the package.
- API reference: the functions and the class.
- Source reference: the library file with its comments.
License#
MIT License.