Erlang
- Erlang is a soft realtime, declarative,
functional language for concurrent, distributed systems.
- It is robust (used for telephone switches!), fail-soft, etc.
- It allows "hot fixes" to running systems.
- It has no threads, but it has really cheap processes.
- It's more like a fleet of Volkswagens than a Maserati.
- Programming in Erlang is a bit odd:
- Variables may only be set once.
- Function calls use a bit of pattern-matching.
- So do (some) variable assignments.
Examples:
A = [1,2,3].
[1,B,3] = A.
B.
B is unbound at line 2, so Erlang fills it in with 2.
-module(test). % Enter the "test" module.
-export([fac/1]). % export a "fac" function with one argument.
fac(0) -> 1; % respond to fac(0) with 1.
fac(N) -> N * fac(N-1). % respont to fac(N) with N * fac(N-1).
The "fac/1" function is defined in the "test" module.
It responds when "fac" is called with one argument.
Links:
Sparks
|