Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/dok.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'doctutorial/README.md')
-rw-r--r--doctutorial/README.md10
1 files changed, 5 insertions, 5 deletions
diff --git a/doctutorial/README.md b/doctutorial/README.md
index ce0a144..e771f56 100644
--- a/doctutorial/README.md
+++ b/doctutorial/README.md
@@ -242,15 +242,15 @@ for i = 1,4 do
end
t7> myfuncs[1]()
-1
+this function has been called 1 times
t7> myfuncs[1]()
-2
+this function has been called 2 times
t7> myfuncs[4]()
-1
+this function has been called 1 times
t7> myfuncs[4]()
-2
+this function has been called 2 times
t7> myfuncs[1]()
-3
+this function has been called 3 times
```
You can use such closures to create objects on the fly, that is, tables which combine functions and data to act upon. Thanks to closure, data can live in arbitrary locations (not necessarily the object's table), and simply be bound at runtime to the function's scope.