摘要:
最近在写goroutine碰到了常见错误 for _, val := range values { go func() { fmt.Println(val) }() } 在这里,实际结果并不是预期的所有值都输出一遍(而是出现data race),FAQ里给出了两种解决方案: // 方案1 for _ 阅读全文
摘要:
Value Restriction是什么? Value restriction是用于控制类型推断能否对值声明进行多态泛化的规则(MLton原文:“The value restriction is a rule that governs when type inference is allowed t 阅读全文
摘要:
Pearl 2: 给定一个长度大于1的列表, 计算其元素的最大surpasser count, 要求算法复杂度$O(n log n)$. Type: msc: Ord a => [a] -> Int "Pearls of functional algorithm design"的第二章, 我们先来看 阅读全文