use*_*907 2 f# design-patterns tuples matching
有没有办法在F#中进行模式匹配,以便检查两个元素元组中的两个元素是否相等.我对F#非常陌生,也是模式匹配整体概念的新手.我正在思考......
let rec funct = function
|(xs, xs) -> 0
etc. etc. etc.
Run Code Online (Sandbox Code Playgroud)
但我想这太容易了.有什么建议?或者甚至有办法做到这一点?谢谢你的帮助,你们非常乐于助人!
match e with
| x,y when x = y -> ...
...
Run Code Online (Sandbox Code Playgroud)
http://msdn.microsoft.com/en-us/library/dd233242.aspx
http://msdn.microsoft.com/en-us/library/dd547125.aspx