Erlang (programming language)/Tutorials

From Citizendium
Jump to navigation Jump to search

Erlang Language Programming Tutorials

Overview

Simple Types

Advanced Types

Examples

Hello World (serial)

Code Example

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

start() ->
   io:format("Hello, world!\n").

Analysis of the example

The Hello World program (see above) appears in many programming languages books and articles as a cursory introduction into a language's syntax. The first hello world program was introduced in the book The C Programming Language[1].

-module(hello) tells the compiler to create a new module(library) called hello. The code tells us the file name for this code: hello.erl.

-export([start/0]). exports a function named start with 0 arguments to the world outside of this module called hello.

start() -> tells the compiler that there is a function named start() with no arguments.

io:format("Hello, world!\n"). will make the program output Hello, world! and a new line (\n) on the screen.

Hello World (parallel)

Parallel Hello

Prime Sieve (parallel with linda type coordination)

Prime Sieve with Linda

Autonomous Agents

Autonomous Agents in Erlang

See definition of Autonomous Agent.

Advanced OTP

ETS

ETS programming

Mimsia

References

1 - Erlang Man Pages at Erlang,org

  1. Cite error: Invalid <ref> tag; no text was provided for refs named K&R