Tutorial by Examples

In Erlang, numbers are either integers or floats. Erlang uses arbitrary-precision for integers (bignums), so their values are limited only by the memory size of your system. 1> 11. 11 2> -44. -44 3> 0.1. 0.1 4> 5.1e-3. 0.0051 5> 5.2e2. 520.0 Numbers can be used in various...
An atom is an object with a name that is identified only by the name itself. Atoms are defined in Erlang using atom literals which are either an unquoted string that starts with a lowercase letter and contains only letters, digits, underscores or the @ character, or A single quoted string Ex...
A binary is a sequence of unsigned 8-bit bytes. 1> <<1,2,3,255>>. <<1,2,3,255>> 2> <<256,257,258>>. <<0,1,2>> 3> <<"hello","world">>. <<"helloworld">> A bitstring is a generalized ...
A tuple is a fixed length ordered sequence of other Erlang terms. Each element in the tuple can be any type of term (any data type). 1> {1, 2, 3}. {1,2,3} 2> {one, two, three}. {one,two,three} 3> {mix, atom, 123, {<<1,2>>, [list]}}. {mix,atom,123,{<<1,2>>,[list...
A list in Erlang is a sequence of zero or more Erlang terms, implemented as a singly linked list. Each element in the list can be any type of term (any data type). 1> [1,2,3]. [1,2,3] 2> [wow,1,{a,b}]. [wow,1,{a,b}] The list's head is the first element of the list. The list's tail...
Each process in erlang has a process identifier (Pid) in this format <x.x.x>, x being a natural number. Below is an example of a Pid <0.1252.0> Pid can be used to send messages to the process using 'bang' (!), also Pid can be bounded to a variable, both are shown below MyProcessId =...
Erlang is a functional programming language. One of the features in a function programming language is handling functions as data (functional objects). Pass a function as an argument to another function. Return function as a result of a function. Hold functions in some data structure. In Erl...
A map is an associative array or dictionary composed of (key, value) pairs. 1> M0 = #{}. #{} 2> M1 = #{ "name" => "john", "age" => "28" }. #{"age" => "28","name" => "john"} 3> M2 = #{ a => {M...
Clarification of Erlang doc on Bit Syntax: 4.4 Defaults [Beginning omitted: <<3.14>> isn't even legal syntax.] The default Size depends on the type. For integer it is 8. For float it is 64. For binary it is the actual size of the specified binary: 1> Bin = << 17/integ...

Page 1 of 1