F#是一种函数式编程语言,能够轻松编写正确且可维护的代码。编程
F#编程主要涉及定义类型推断和自动泛化的类型和函数。 这使您能够将焦点保留在问题域上并操纵其数据,而不是编程的细节。app
open System // Gets access to functionality in System namespace. // Defines a function that takes a name and produces a greeting. let getGreeting name = sprintf "Hello, %s! Isn't F# great?" name [<EntryPoint>] let main args = // Defines a list of names let names = [ "Don"; "Julia"; "Xi" ] // Prints a greeting for each name! names |> List.map getGreeting |> List.iter (fun greeting -> printfn "%s" greeting) 0
F#有许多功能,包括:异步
// Group data with Records type SuccessfulWithdrawal = { Amount: decimal Balance: decimal } type FailedWithdrawal = { Amount: decimal Balance: decimal IsOverdraft: bool } // Use discriminated unions to represent data of 1 or more forms type WithdrawalResult = | Success of SuccessfulWithdrawal | InsufficientFunds of FailedWithdrawal | CardExpired of System.DateTime | UndisclosedFailure
F#记录和区分联合在默认状况下是非null,不可变和可比较的,使它们很是容易使用。完整教程阅读http://nopapp.com/Blog/Article/FSharp-What-Is-FSharp编程语言