Erlang

From Omnia
Revision as of 14:40, 21 October 2014 by Kenneth (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Erlang

"Build massively scalable soft real-time systems" [1]

"Erlang is a programming language used to build massively scalable soft real-time systems with requirements on high availability. Some of its uses are in telecoms, banking, e-commerce, computer telephony and instant messaging. Erlang's runtime system has built-in support for concurrency, distribution and fault tolerance." [2]

Erlang Niche

'"For fault-tolerant, distributed runtimes with memory-isolated process and message-passing concurrency, Erlang pretty much stands alone." [3]

Installation

Manual Installation

Erlang - http://www.erlang.org/

yum -y install java java-devel unixODBC-devel
# java-devel will install java-1.6.0-openjdk-devel, which has javac
mkdir -p ~/.src ; cd ~/.src
wget http://www.erlang.org/download/otp_src_R15B.tar.gz
tar -zvxf otp_src_R15B.tar.gz
cd otp_src_R15B
./configure --prefix=/opt/erlang
make clean && make && sudo make install

RedHat/CentOS Installation

with 'epel' repo installed:

yum install erlang

Debian/Ubuntu Installation

apt-get install erlang

Hello World

hello.erl:

-module(hello).
-export([hello_world/0]).

% This is a comment

hello_world() ->
    io:fwrite("hello,"),
    io:fwrite(" world\n").

compile and run from erl shell:

$ erl
1> c(hello).
{ok,hello}

2> hello:hello_world().
hello, world
ok

3> [Control+C] [or Control+G]
q

compile and run from command line:

$ erl -compile hello
$ erl -noshell -s hello hello_world -s init stop
hello, world

References:

Examples

Erlang - Programming Examples User's Guide - http://www.erlang.org/doc/programming_examples/users_guide.html

keywords