F# F中的工厂模式#
对于这种类型:F# F中的工厂模式#,f#,F#,对于这种类型: let Empty = { Buy = new Dictionary<int64, int64 * float>() Sell = new Dictionary<int64, int64 * float>() } 它们将代表相同的词典 如何每次生成一个新实例?让makeEmpty()={ let makeEmpty () = { Buy = new Dictio
let Empty =
{
Buy = new Dictionary<int64, int64 * float>()
Sell = new Dictionary<int64, int64 * float>()
}
它们将代表相同的词典
如何每次生成一个新实例?让makeEmpty()={
let makeEmpty () = {
Buy = new Dictionary<int64, int64 * float>()
Sell = new Dictionary<int64, int64 * float>()
}
购买=新字典()
Sell=新字典()
}
只要把它变成一个函数就行了<代码>()=>…。当然。。我可以看出睡眠不足正困扰着我:D谢谢!我也是,这还不接近F#语法!但我希望你还是能明白:哈哈,是的,不是的worries@glennsl回答这个问题。
let makeEmpty () = {
Buy = new Dictionary<int64, int64 * float>()
Sell = new Dictionary<int64, int64 * float>()
}