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:
authorSoumith Chintala <soumith@gmail.com>2016-01-07 18:32:27 +0300
committerSoumith Chintala <soumith@gmail.com>2016-01-07 18:32:27 +0300
commitb5e9ffe80fb3240c3e3102ee7d3e58220d2555ab (patch)
treee5e0cfb6f20bb9a0660e6501bd5a121d155e8119
parent2adabfa57361ff6783134d275cf5c0a6536620d3 (diff)
parent6e8404dc8ec394347950677a5142422e3ec9ae59 (diff)
Merge pull request #11 from yotam/closure-example-fix
Fix small discrepancy between closure example and output.
-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.