有了C,我可以写一个通用的文本编辑器(IG纳米)中的程序,并与编译F#程序的命令行
gcc mySum.c -o mySum
编译它在LUNIX终端得到一个窗口,要求输入并返回输出。
#include <stdio.h>
int main(){
int x;
int y;
int sum;
printf("Program that sums two numbers.\n\nPlease type the first one:\n");
scanf("%d", &x);
printf("Type the second one:\n");
scanf("%d", &y);
sum = x + y;
printf("The sum of %d and %d is %d\n", x, y, sum);
return 0;
}
我可以在没有Visual Studio/MonoDevelopment的情况下在F#中生成相同类型的程序吗?
我发现我对使用裸体文本编辑器工作非常有指导意义,就像我正在用C做的一样。它让我更加专注于学习,而IDE的帮助更少。此外,文本编辑器(如nano,或记事本++或其他)提供比fsharpi
更灵活的工具来编写progra canm。通过这种方式,当程序完成后,我将以与C中相同的方式将其交给编译器。
我将通过实施功能
let mySum x y =
x + y
与
fsharpc mySum.fs
说,但我过不了怎么去实现它。我发现this reference但它有点高级。
您知道[Visual Studio Code](https://code.visualstudio.com/),它在Linux上运行,不会与Visual Studio混淆。请参阅[使用Ionide的Visual Studio代码中的F#入门](https://docs.microsoft.com/en-us/dotnet/articles/fsharp/tutorials/getting-started/getting-started-vscode) –
@GuyCoder,我向你的回答添加了你的建议,谢谢。它是VS最准系统的版本,我从来没有用过它,但是我相信它是相当流行和优秀的,如果你只对编写代码感兴趣而且没有其他需要。 – Abel
@Abel你应该考虑安装Visual Studio代码。对于快速到小型的项目,甚至F#以外的项目,例如JS,HTML,XML,json,[DOT](http://www.graphviz.org/doc/info/lang.html),Prolog,程序集,Markdown, OCaml和其他的东西,它是我的IDE。 –