
| Erlang语言 | |
|---|---|
| 多种范型:函数式、并发式 | |
|
面市時間
|
1987年 |
|
设计者
|
爱立信 |
|
实作者
|
爱立信 |
| 最近释出日期 | R12B-2/ 2008年4月 |
|
启发语言
|
Prolog、LISP |
|
影响语言
|
Scala |
| Solaris、SUSE、Microsoft Windows、VxWorks | |
Erlang是一种通用的面向并发的编程语言,它由瑞典电信设备制造商爱立信所辖的CS-Lab开发,目的是创造一种可以应对大规模并发活动的编程语言和运行环境。Erlang问世于1987年,经过十年的发展,于1998年发布开源版本。Erlang是运行于虚拟机的解释性语言,但是现在也包含有乌普萨拉大学高性能Erlang计划(HiPE)[1]开发的本地代码编译器,自R11B-4版本开始,Erlang也开始支持脚本式解释器。在编程范型上,Erlang属于多重范型编程语言,涵盖函数式、并发式及分布式。
目录 |
Erlang得名于丹麦数学家及统计学家Agner Krarup Erlang,同时Erlang还可以表示Ericsson Language。
1998年起,Erlang发布开源版本,采用修改过的Mozilla公共许可证协议进行发放,同时爱立信仍然提供商业版本的技术支持。目前,Erlang最大的商业用户是爱立信,其他知名用户有北电网络、Amazon.com以及T-Mobile等[2]。
Ering函数大致写法如下,以一个求整数阶乘的模块为例:
-module(fact). -export([fac/1]). fac(0) -> 1; fac(N) when N > 0 -> N * fac(N-1).
下面是快速排序算法的一个Erlang实现:
%% quicksort:qsort(List)
%% Sort a list of items
-module(quicksort).
-export([qsort/1]).
qsort([]) -> [];
qsort([Pivot|Rest]) ->
qsort([ X || X <- Rest, X <= Pivot]) ++ [Pivot] ++ qsort([ Y || Y <- Rest, Y > Pivot]).
代码示例如下:
% create process and call the function web:start_server(Port, MaxConnections)
ServerProcess = spawn (web, start_server, [Port, MaxConnections]),
% create a remote process and call the function web:start_server(Port, MaxConnections) on machine RemoteNode
RemoteProcess = spawn(RemoteNode, web, start_server, [Port, MaxConnections]),
% send the {pause, 10} message (a tuple with an atom "pause" and a number "10") to ServerProcess (asynchronously)
ServerProcess ! {pause, 10},
% receive messages sent to this process
receive
a_message -> do_something;
{data, DataContent} -> handle(DataContent);
{hello, Text} -> io:format("Got hello message: ~s", [Text]);
{goodbye, Text} -> io:format("Got goodbye message: ~s", [Text])
end.
|
查 • 论 • 编 • 历
|
|
|---|---|
| 工业编程语言 | A+ - Ada - 汇编语言 - B - Brainfuck - COBOL - Curl - D - Eiffel - Erlang - FORTRAN - IronPython - Java - Jython - LISP - Lua - SCILAB - MATLAB - MATHEMATICA - Nuva - Oberon - OCaml - Perl - PHP - PostScript - Powerbuilder - Python - R - REXX - Ruby - Self - Smalltalk - Tcl/Tk - C# - F# - J# - Microsoft Visual C# |
| C/C++语言 | C - C++ - Turbo C++ - Borland C++ - C++ Builder- C++/CLI - Objective-C - Microsoft Visual C++ |
| BASIC语言 | BASIC - BASICA - GW-BASIC - QBASIC - QuickBASIC - True BASIC - Turbo BASIC - PowerBASIC - DarkBASIC - ETBASIC - GVBASIC Visual Basic .NET - Visual Basic - VBScript - VBA |
| Pascal/Delphi语言 | Pascal语法:(Pascal - Turbo Pascal - Object Pascal - Free Pascal) Pascal+Delphi语法:(Delphi) |
| ECMAScript方言 | ActionScript - DMDScript - JavaScript - JScript |
| GPU用着色器语言 | Cg - GLSL - HLSL |
| 学术编程语言 | APL/J - Clean - Haskell - Logo - ML - Prolog - Scheme - SAC |
| 数据库相关编程语言 | Clipper - Visual FoxPro - SQL - SQL預存程序 |
| 其他编程语言 | ALGOL - Forth - Modula-2/Modula-3 - MUMPS - PL/I - Simula |
Why are we here?
All text is available under the terms of the GNU Free Documentation License
This page is cache of Wikipedia. History