F#之旅1 - Why use F#?为什么要用F#?
原文地址:http://fsharpforfunandprofit.com/why-use-fsharp/
Why use F#?
Why you should consider using F# for your next project
为什么要用F#?
为什么你应该考虑在下一个项目使用F#
Although F# is great for specialist areas such as scientific or data analysis, it is also an excellent choice for enterprise development. Here are five good reasons why you should consider using F# for your next project.
F#不仅仅在科学和数据分析这类专业领域很适用,对于企业开发来说它也是个很好的选择。以下是为什么你应该考虑在下一个项目使用F#的五个原因。
Conciseness
F# is not cluttered up with coding "noise" such as curly brackets, semicolons and so on.
You almost never have to specify the type of an object, thanks to a powerful type inference system.
And, compared with C#, it generally takes fewer lines of code to solve the same problem.
简洁
F#不会被大括号、分号等代码“杂音”弄得乱七八糟。
多亏强大的类型推导系统,你几乎不需要指定对象的具体类型。
并且,相对于C#,它通常只用更少的代码就能解决同样的问题。
Convenience
Many common programming tasks are much simpler in F#. This includes things like creating and using complex type definitions, doing list processing, comparison and equality, state machines, and much more.
And because functions are first class objects, it is very easy to create powerful and reusable code by creating functions that have other functions as parameters, or that combine existing functions to create new functionality.
方便
一些常见的编程任务在F#里非常简单。例如:创建和使用一个复杂的自定义类型,处理列表,比较,状态机等等。
并且,由于函数是"第一等公民",所以可以通过创建函数的方式,来轻松的编写强大可重用的代码,创建函数时,可以用其它函数作为参数,或者合并已有的函数来创造新的功能。
Correctness
F# has a powerful type system which prevents many common errors such as null reference exceptions.
Values are immutable by default, which prevents a large class of errors.
In addition, you can often encode business logic using the type system itself in such a way that it is actually impossible to write incorrect code or mix up units of measure, greatly reducing the need for unit tests.
正确
F#有一个强大的类型系统,可以预防例如空指针应用之类的常见错误。
值默认是不可变的,也可以预防一大类的错误。
此外,你还可以使用类型系统本身对业务逻辑进行编码,这样就不可能写出不正确的代码,或者混淆度量单位,大大降低了对单元测试的需求。
Concurrency
F# has a number of built-in libraries to help when more than one thing at a time is happening. Asynchronous programming is very easy, as is parallelism. F# also has a built-in actor model, and excellent support for event handling and functional reactive programming.
And of course, because data structures are immutable by default, sharing state and avoiding locks is much easier.
并发
F#有一些内置的库来帮助处理多件事同时发生的情况。因为并发,异步编程也很简单。F#还内置了一个actor模型,对事件处理和反射式编程也有很好的支持。
当然,因为默认情况下数据结构是不可变的,共享状态和避免锁也容易得多了。
Completeness
Although it is a functional language at heart, F# does support other styles which are not 100% pure, which makes it much easier to interact with the non-pure world of web sites, databases, other applications, and so on. In particular, F# is designed as a hybrid functional/OO language, so it can do virtually everything that C# can do.
Of course, F# is part of the .NET ecosystem, which gives you seamless access to all the third party .NET libraries and tools. It runs on most platforms, including Linux and smart phones (via Mono).
Finally, it is well integrated with Visual Studio, which means you get a great IDE with IntelliSense support, a debugger, and many plug-ins for unit tests, source control, and other development tasks. Or on Linux, you can use the MonoDevelop IDE instead.
完备
尽管F#的核心是函数式编程语言,但是它并不是百分百的纯函数式,F#支持其它的编程范式,这样可以让它更方便的与web网站、数据库、其它应用等进行交互。特别是F#被设计成一个混合性/面向对象的编程语言,所以它几乎可以做所有C#能做的事。
当然,作为.NET生态系统的一部分,F#可以无缝连接所有的第三方.NET库和工具。他可以运行在包括Linux和智能设备在内的大部分系统平台。
最后,它与VS高度集成,意味着你可以得到强悍的智能感知,调试器,以及各种单元测试、代码版本控制之类的插件等等。在Linux平台,你也可以使用MonoDevelop来作为IDE。
F#之旅1 - Why use F#?为什么要用F#?的更多相关文章
- F#之旅4 - 小实践之快排
参考文章:https://swlaschin.gitbooks.io/fsharpforfunandprofit/content/posts/fvsc-quicksort.html F#之旅4 - 小 ...
- F#之旅0 - 开端
F#之旅0 - 开端 UWP的学习告一段落,CozyRSS的UWP版本并没有做.UWP跟wpf开发几乎一模一样,然后又引入了很多针对移动设备的东西,这部分有点像android.没啥太大的意思,不难,估 ...
- F# 之旅(上)
写在前面的话 解答一下在上一篇文章<在Visual Studio中入门F#>中有人的提问, 1. 问:是准备写 F# 系列吗? 答:当然不是,本人也是刚刚学习 F#,只是翻译微软官方 ...
- F# 之旅(下)
写在前面的话 学习 F# 一定要去体会函数式编程的特点,推荐一下阮一峰的日志<函数式编程入门教程>. 在这篇文章中 递归函数 记录和可区分联合类型 模式匹配 可选类型 度量单位 类和接口 ...
- F#之旅3 - F# PK C#:简单的求和
原文链接:https://swlaschin.gitbooks.io/fsharpforfunandprofit/content/posts/fvsc-sum-of-squares.html Comp ...
- F#之旅9 - 正则表达式
今天,cozy群有个群友发了条正则,问正则匹配相关的问题.虽然他的问题用html selector去处理可能更好,但是我也再一次发现:我忘了正则怎么写的了! 忘掉正则是有原因的,这篇文章会简单记录下F ...
- F#之旅8 - 图片处理应用之动画二维码
首先,先介绍下什么是动画二维码.前些天在网上闲逛,突然看到一个开源项目,发现一种二维码的新玩法.https://github.com/sylnsfar/qrcode/blob/master/READM ...
- F#之旅6 - 简单AV推荐系统
上回说到用F#来写爬虫,这只是F#学习第一阶段的第一步.最开始,就对第一阶段做了这样的安排: 1.爬虫爬取AV数据 2.数据处理和挖掘 3.数据可视化(使用ECharts) 4.推荐系统 第一步很快就 ...
- F#之旅5 - 小实践之下载网页(爬虫基础库)
参考文章:https://swlaschin.gitbooks.io/fsharpforfunandprofit/content/posts/fvsc-download.html 参考的文章教了我们如 ...
随机推荐
- Eclispe远程调试tomcat设置
首先在catelina.sh中添加 JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=23787,server=y,su ...
- sql注入时易被忽略的语法技巧以及二次注入
那些容易被忽略.容易被弄错的地方 sql注入时的技巧 ========================================================================= ...
- javascript 获取滚动条高度+常用js页面宽度与高度
/******************** * 取窗口滚动条高度 ******************/function getScrollTop(){ var scrollTop=0; ...
- Markdown编辑器:Typora
现在网上的Markdown有很多,各有各的特色,同时也有各自的缺点.比如有的传图片比较麻烦,有的导出pdf需要付费,有的数学公式编辑比较麻烦等等...... 而最近接触到Typora,发现这真是一款良 ...
- latex公式编号
1 \begin{flalign*} 2 % In this way (this arrange of &), the equation will in the center and alig ...
- Intern---Microsoft Academic China Team
项目二: AEther: 项目 一.项目需求:对搜索关键词进行类别的统计分析,为了后面的entity-rank做准备. 0,各种关键数据统计: 数据量:1个月数据:about 1000T. 1,对IE ...
- 【转】使用Python matplotlib绘制股票走势图
转载出处 一.前言 matplotlib[1]是著名的python绘图库,它提供了一整套绘图API,十分适合交互式绘图.本人在工作过程中涉及到股票数据的处理如绘制K线等,因此将matplotlib的使 ...
- mysql 5.7 的安装配置与 navicat premium for mysql 11 的破解使用
再安装mysql5.7 或以上的版本出现了一些问题,现在总结下,希望能给初入学习mysql的人一下帮助,大牛就不要来嘲笑小弟我了 首先准备如下: 1.下载mysql 5.7,下载地址:https:// ...
- 48. 二叉树两结点的最低共同父结点(3种变种情况)[Get lowest common ancestor of binary tree]
[题目] 输入二叉树中的两个结点,输出这两个结点在数中最低的共同父结点. 二叉树的结点定义如下: C++ Code 123456 struct BinaryTreeNode { int ...
- python address already in use
1)找到使用端口的进程pid netstat -lp 2)kill掉pid kill -9 1234