F♯

科技工作者之家 2020-11-17

**F#**是由微软发展的为.NET语言提供运行环境的程序设计语言,是函数编程语言(FP,Functional Programming),函数编程语言最重要的基础是Lambda Calculus。它是基于OCaml的,而OCaml是基于ML函数程序语言。有时F#和OCaml的程序是可以交互编译的。

简介编程范型:多范型:函数编程语言,指令式编程,面向对象编程,元编程,并发计算。

启发语言:ML,OCaml,C#,Python,Haskell,Scala,Erlang.

F#已经接近成熟,支持高阶函数、柯里化、惰性求值、Continuations、模式匹配、闭包、列表处理和元编程。这是一个用于显示.NET在不同编程语言间互通的程序设计,可以被.NET中的任意其它代码编译和调用。

2002年微软开始由Don Syme带领研发F#,从C#,LINQ和Haskell中获取了经验,2005年推出第一个版本,2007年7月31日释出1.9.2.9版。2007年底,微软宣布F#进入产品化的阶段。

F#已被集成在Visual Studio2010中,版本是2.0,含有对.Net Framework的完全支持。

F#在Visual Studio2015中,版本是4.0。

F#在Visual Studio2017中,版本是4.1。1

范例一些小小范例如下:

(* This is a comment *)(* Sample hello world program *)printf "Hello World!"#lightopen Microsoft.FSharp.Collection.List(* print a list of numbers recursively *)let rec printlist l = (* When using "#light", you must indent with 4 spaces *) if l = [] then else printf "%d\n" (nth l 0) printlist (tl l)#light(* Sample Windows Forms Program *)(* We need to open the Windows Forms library *)open System.Windows.Forms(* Create a window and set a few properties *)let form = new Form(Visible=true, TopMost=true, Text="Welcome to F#")(* Create a label to show some text in the form *)let label = let temp = new Label() let x = 3 + (4 * 5) (* Set the value of the Text*) temp.Text

科技工作者之家

科技工作者之家APP是专注科技人才,知识分享与人才交流的服务平台。