Commit Graph
19 Commits
Author SHA1 Message Date
L1nSn0wandGitHub a08a8f4162 Revise chapter 5.6 on anonymous functions and closures
This section introduces anonymous functions in Go, explaining their syntax, usage, and implications in terms of closures and lexical environments. It also discusses common pitfalls related to variable capture in loops and provides examples of breadth-first search and topological sorting.
2025-09-02 15:44:42 +08:00
chai2010andGitHub 687fb92030 Revert "Update ch5-06.md" 2024-04-03 16:09:26 +08:00
AcaibridandGitHub 8df9c1211c Update ch5-06.md
返回的是一个函数,而不是返回的这个函数被调用后的返回值
2024-02-05 01:32:21 +08:00
chai2010 06a1bdf735 转为 mdbook 2022-08-04 14:58:52 +08:00
Jun10ng fac168795c Update ch5-06.md
之前的翻译有些许晦涩,没有表达出主要意思。查阅原文后重新翻译。
请谨慎合并。
2020-04-27 22:13:59 +08:00
Xargin 7fbf986ec2 fix typo
diff --git a/ch5/ch5-06.md b/ch5/ch5-06.md
index b7e8d65..ebaabd0 100644
--- a/ch5/ch5-06.md
+++ b/ch5/ch5-06.md
@@ -91,7 +91,7 @@ func topoSort(m map[string][]string) []string {
 }
 ```

-当匿名函数需要被递归调用时,我们必须首先声明一个变量(在上面的例子中,我们首先声明了 visitAll),再将匿名函数赋值给这个变量。如果不分成两部,函数字面量无法与visitAll绑定,我们也无法递归调用该匿名函数。
+当匿名函数需要被递归调用时,我们必须首先声明一个变量(在上面的例子中,我们首先声明了 visitAll),再将匿名函数赋值给这个变量。如果不分成两步,函数字面量无法与visitAll绑定,我们也无法递归调用该匿名函数。

 ```Go
 visitAll := func(items []string) {
2018-09-26 10:40:16 +08:00
kimw 0ab7557665 修正半角标点符号 2018-05-27 17:56:55 -04:00
zhliner ff3c5b0a70 第5章,部分字词修订。 2017-08-24 22:27:42 +08:00
Xargin 853e2ad052 fix typo 2016-09-30 21:56:19 +08:00
chai2010 2b37b23285 回到简体 2016-02-15 11:06:34 +08:00
chai2010 dc16c5b6c7 fmt code 2016-01-27 18:06:08 +08:00
chai2010 20a8cf71b9 ch5: fix code path 2016-01-21 09:58:28 +08:00
chai2010 9666211cd7 Fix typo
Fixes #198
2016-01-18 11:22:04 +08:00
D 178f6e769b array->slice 2016-01-08 19:02:59 +08:00
chai2010 d009337c0f fix format 2016-01-08 15:49:19 +08:00
chai2010 a73964c305 make loop 2016-01-08 15:42:18 +08:00
D d212b6bbdb ch5-6 done 2016-01-08 15:28:11 +08:00
chai2010 224ca8ecfd 初始化缺少的章节 2016-01-03 10:11:41 +08:00
chai2010 1693baf5de good good study, day day up! 2015-12-09 15:45:11 +08:00