【发布时间】:2019-01-11 08:07:35
【问题描述】:
我正在努力更好地理解活动模式的工作原理 - 如果我读错了活动模式,请纠正我,举个例子:
let (|UpperCase|) (x:string) = x.ToUpper()
let result = match "foo" with
| UpperCase "FOO" -> true
| _ -> false
我知道我们在比较
(Uppercase "foo") with "FOO"
但在这种情况下看起来很奇怪,当我阅读时
| UpperCase "Foo"
这段代码不应该写成这样吗
let result = match UpperCase "foo" with
有没有更好的阅读方式?
【问题讨论】:
标签: f#