F#函数式编程语言
F#是由微软发展的为微软.NET语言提供运行环境的程序设计语言,是函数编程语言(FP,Functional Programming),函数编程语言最重要的基础是Lambda Calculus。它是基于OCaml的,而OCaml是基于ML函 数程式语言。有时F# 和 OCaml 的程式是可以交互编译的。
F#已经接近成熟,支援Higher-Order Function、Currying、Lazy Evaluation、Continuations、Pattern Matching、Closure、List Processing、Meta-Programming。这是一个用于显示.NET在不同编程语言间互通的程序设计,可以被.NET中的任意其它代码编 译和调用。
F#将被集成在Visual Studio 2010中,含有对.Net Framework的完全支持。
一些小小范例如下:
(* This is a comment *) (* Sample hello world program *) printf "Hello World!"
#light open 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 <- x (* Remember to return a value! *) temp (* Add the label to the form *) do form.Controls.Add(label) (* Finally, run the form *) do Application.Run(form)
评论
Whiley函数式编程语言
Whiley是一个轻量级面向对象和函数式编程语言,目标代码在Java虚拟机上执行。Whiley在编译时就可以排除很多错误,例如除0、数组越界和空引用等。示例代码:voidSystem::main([s
Whiley函数式编程语言
0
Haskell函数式编程语言
Haskell是一种纯函数式编程语言,它的命名源自美国数学家HaskellBrooksCurry,他在数学逻辑方面上的工作使得函数式编程语言有了广泛的基础。Haskell语言是1990年在编程语言Mi
Haskell函数式编程语言
0
Futhark函数式编程语言
Futhark是一个小型全新的函数式编程语言,可编译为高性能的GPU代码。使用静态类型、并行数据以及纯函数数组语言。该语言对编译器提前进行重度的优化,通过OpenCL生成GPU代码。Futhark并非
Futhark函数式编程语言
0