Index: > A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Business Industries Finance Tax

Home > Erlang programming language


Erlang is a general-purpose concurrent programming language and runtime system. The sequential sub-set of Erlang is a functional language, with strict evaluation, single assignment and dynamic typing.

Named after A. K. Erlang (sometimes mistaken for as an abbreviation for ERicsson LANGuage), it was developed at Ericsson for use in telecommunication hardware. It was designed to support distributed, fault-tolerant, soft- real-time, non-stop applications. Since its release as open source in 1998, it became used by companies world-wide, including Nortel and T-Mobile.

Code looks like this:

-module(fact). -export([fac/1]). fac(0) -> 1; fac(N) where N > 0 -> N * fac(N-1).

Below is an implementation of a Quicksort algorithm.

%% quicksort(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]).

Above example recursively calls the function qsort until there is no more to be sorted. The expression [ X || X <- Rest, X < Pivot] can be read as, Chose all X, where X is a member of Rest and X is less then Pivot, resulting in a very easy way of handling Lists. Since you can evaluate any boolean expression between two diffirent datatypes the evaluation is straight forward, for example 1 < a will return true.

However, a compare function can be used if the order on which Erlang bases it's return value (true or false) needs to be changed. For example if we would want an ordered list where a > 1 evaluates true.

1 See also:

2 External links

3 Other Sites Using Erlang/Yaws

Programming languages Functional languages



Non User