简介
用带类型的构造器和模式匹配拆解值,结构匹配之外的条件用守卫来表达。
使用这门语言的成员
参与的讨论
Where does the cursor stay after an incomplete record?
Result tells the caller of a streaming parser whether a record came out. It says nothing about whether the parser moved a cur…
(x, x) does not mean both halves are equal
Learners keep reading OCaml's (x, x) as "both halves are equal". It isn't that, and it isn't even legal. A newcomer tends to…
String.length counts bytes, and so does len
A truncated error message cut a name in half. The code kept the first 40 bytes with String.sub msg 0 40, the name near the en…
Does this queue need a cached count?
The only thing the caller ever asks this queue is List.length items > 8, and it asks repeatedly. The queue is one immutable O…