如果您来自Matlab和R背景,那么开发过程通常是非常交互式的(选择、运行所选内容、修复、选择、运行所选内容、修复等等)。我正在尝试弄清楚F#如何处理这种开发风格,因为这在科学应用程序中似乎非常重要。以下是对于新手来说立即想到的一些事情:
Selecting multiple lines gives different results than one line at a time.
let add x y = x + y add 4.1 2.3
Selecting both lines results in
float -> float -> float
whereas selecting the first line results inint -> int -> int
. More generally, matlab/R users are used to results printing out after each statement, not at the end.Shadow copying can become burdensome.
let file = open2GBfile('file.txt') process file
If you run this interactively over and over again, the 2GB file is shadow copied and you will quickly run out of memory. Making file mutable doesn't seem like the appropriate solution, since the final run of the program will never change it.
fsi.exe
的系统是否不可能支持类似 matlab/R 的交互式开发?[编辑:我猜想问题2.如果对象被遮蔽,它们是否会被立即标记为删除?]
mutable
或ref-cell,则内存永远不会被释放。但是再次写入额外的mutable
或ref
在你的let声明中,然后在后续赋值上使用<-
或者:=
,在我看来并不是太烦人。 - Gabriel