Erlang (programming language)/Tutorials: Difference between revisions
Jump to navigation
Jump to search
imported>Eric Evers |
imported>Eric Evers |
||
Line 5: | Line 5: | ||
==Basic Erlang== | ==Basic Erlang== | ||
:[[/Terms|Terms]] | |||
:[[/Pattern Matching|Pattern Matching]] | |||
:[[/Expressions|Expressions]] | |||
:[[/Functions|Functions]] | |||
:[[/guards|Guards]] | |||
:[[/Modules|Modules]] | |||
:[[/Errors|Errors]] | |||
:[[/Processes|Processes and Messages]] | |||
:[[/Timeouts|Timeouts]] | |||
:[[/Macros|Macros]] | |||
:[[/Techniques of Recursion|Techniques of Recursion]] | |||
:[[/List Comprehensions|List Comprehensions]] | |||
:[[/List Comments/]] | |||
==Syntax== | ==Syntax== |
Revision as of 18:53, 19 April 2008
Erlang Language Programming Tutorials
Overview
Basic Erlang
- Terms
- Pattern Matching
- Expressions
- Functions
- Guards
- Modules
- Errors
- Processes and Messages
- Timeouts
- Macros
- Techniques of Recursion
- List Comprehensions
- List Comments
Syntax
Syntax of functions
Functions are defined by the domain of the arguments and the number of arguemnts. A function ends with a period. A function defined over differnt domains are separated by semicolons. A fact function gives an answer that is sensitive to the domain of the input. With strings it gives a fact. With counting numbers it gives the factorial function.
fact("aloha") -> "Aloha is a greating"; fact(String) when is_a_list(String) -> "no fact is known about " ++ String; fact(0) -> 1; fact(N) when is_integer(N) and (N > 0) -> fact(N-1)*N; fact(N) when N < 0 -> error.
Macros
-define(LIKERT_SCALE, lists:seq(1, 5)).
A = LIKERT_SCALE.
Simple Types
Advanced Types
Popular Modules
Example programs
Hello World (Serial)
Hello World (parallel)
Prime Sieve with Linda
Autonomous Agents in Erlang
See definition of Autonomous Agent.