【发布时间】:2014-06-27 10:47:34
【问题描述】:
我刚刚开始使用 F#,但我有一些类似于以下的代码:
let square x = x*x
let result = square 5.1
let result' = square 12
很遗憾,这会导致以下错误:This expression was expected to have type float but here has type int
对于这个问题是否有一个惯用的 F# 解决方案,或者我的想法被我的 C# 经验所污染?
【问题讨论】:
标签: f# inline type-resolution