**F#**是由微軟發(fā)展的為.NET語言提供運(yùn)行環(huán)境的程序設(shè)計(jì)語言,是函數(shù)編程語言(FP,F(xiàn)unctional Programming),函數(shù)編程語言最重要的基礎(chǔ)是Lambda Calculus。它是基于OCaml的,而OCaml是基于ML函數(shù)程序語言。有時(shí)F#和OCaml的程序是可以交互編譯的。
簡介編程范型:多范型:函數(shù)編程語言,指令式編程,面向?qū)ο缶幊?元編程,并發(fā)計(jì)算。
啟發(fā)語言:ML,OCaml,C#,Python,Haskell,Scala,Erlang.
F#已經(jīng)接近成熟,支持高階函數(shù)、柯里化、惰性求值、Continuations、模式匹配、閉包、列表處理和元編程。這是一個(gè)用于顯示.NET在不同編程語言間互通的程序設(shè)計(jì),可以被.NET中的任意其它代碼編譯和調(diào)用。
2002年微軟開始由Don Syme帶領(lǐng)研發(fā)F#,從C#,LINQ和Haskell中獲取了經(jīng)驗(yàn),2005年推出第一個(gè)版本,2007年7月31日釋出1.9.2.9版。2007年底,微軟宣布F#進(jìn)入產(chǎn)品化的階段。
F#已被集成在Visual Studio2010中,版本是2.0,含有對(duì).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