【发布时间】:2011-07-02 01:47:51
【问题描述】:
我们都习惯于在某些情况下进行模式匹配是特定类型,例如,
match x with
| Y(x) :: tail -> ... // assumes List.head(x) is of type Y(x)
但是当某些东西 不是 的特定类型时,我如何才能匹配这种情况呢?例如,
match x with
| Not Y(_) :: tail -> ... // List.head(x) is definitely not a Y
谢谢!
【问题讨论】:
标签: f# functional-programming pattern-matching active-pattern