SlideShare uma empresa Scribd logo
1 de 21
Baixar para ler offline
Erlang
What is it?
created by Joe Armstrong in 1986 at Ericcsson Telecom
based on Prolog
functional language
dynamicly typed
Erlang is...

reliable

high concurrent (no threads. light processes)

modular
Where is it used?
RabbitMQ (France telecom)
CouchDB
Facebook Chat
GitHub (egitd)
SimpleDB (AWS)
Types
Variables


Var = 2.
Var.
%=> 2
Var = 3. % this throws an error!
atoms


this_is_atom
Lists


[1,2,3,4]
Tuples

{a, 2,"d"}.
{ company,
  {name, "Applicake",
  {address, "Krakow"}}
}.
Matching


Company = {company,
      {name, "Applicake"},
      {address, "Krakow"}
     }.

{company, {name, Name,
 {address, Address}}} = Company.

Name %=> "Applicake"
Address %=> "Krakow"
Matching

[Head | Tail] = [1,2,3,4].
Head. %=> 1
Tail. %=> [2,3,4]
Matching

[One, Two | Rest] = [1,2,3,4].
One. %=> 1
Two. %=> 2
Rest.%=> [3,4]
functions
-module(mirror_function).
-export([mirror/1]).
mirror(Argument) -> Argument.
functions
-module(matching_function).
-export([number/1]).

number(one) -> 1;
number(two) -> 2;
number(three) -> 3.
functions
Numbers = [1,2,3,4].
lists:map(fun(X) -> X+1 end, Numbers).
%=> [2,3,4,5]
functions

map(F, [H|T]) -> [F(H) | map(F, T)];
map(F, []) -> [].
Control structures
                       case...

case Animal of
 "dog" -> underdoga;
 "cat" -> thundercat
 _ -> something_else
end.
Control structures
                      if...

if
 X > 0 -> positive;
 X < 0 -> negative;
 true -> zero
end.
Processes
Processes

Pid = spawn(fun module_name:function_name/0).

Pid ! "message".
Processes


fuction_name() ->
  receive
   "message" ->
    io::format("Hi!"),
    function_name();
  _ ->
   io::format("Whatever..."),
   function_name()
end.

Mais conteúdo relacionado

Mais procurados

One Monad to Rule Them All
One Monad to Rule Them AllOne Monad to Rule Them All
One Monad to Rule Them AllJohn De Goes
 
Arrays in python
Arrays in pythonArrays in python
Arrays in pythonLifna C.S
 
Blazing Fast, Pure Effects without Monads — LambdaConf 2018
Blazing Fast, Pure Effects without Monads — LambdaConf 2018Blazing Fast, Pure Effects without Monads — LambdaConf 2018
Blazing Fast, Pure Effects without Monads — LambdaConf 2018John De Goes
 
Haskell for data science
Haskell for data scienceHaskell for data science
Haskell for data scienceJohn Cant
 
High-Performance Haskell
High-Performance HaskellHigh-Performance Haskell
High-Performance HaskellJohan Tibell
 
Humble introduction to category theory in haskell
Humble introduction to category theory in haskellHumble introduction to category theory in haskell
Humble introduction to category theory in haskellJongsoo Lee
 
7 Habits For a More Functional Swift
7 Habits For a More Functional Swift7 Habits For a More Functional Swift
7 Habits For a More Functional SwiftJason Larsen
 
Intro to Functional Programming
Intro to Functional ProgrammingIntro to Functional Programming
Intro to Functional ProgrammingHugo Firth
 
Composition birds-and-recursion
Composition birds-and-recursionComposition birds-and-recursion
Composition birds-and-recursionDavid Atchley
 
Functional programming with haskell
Functional programming with haskellFunctional programming with haskell
Functional programming with haskellfaradjpour
 
Java: Introduction to Arrays
Java: Introduction to ArraysJava: Introduction to Arrays
Java: Introduction to ArraysTareq Hasan
 
Functional programming in Python
Functional programming in PythonFunctional programming in Python
Functional programming in PythonColin Su
 
Introduction to Monads in Scala (1)
Introduction to Monads in Scala (1)Introduction to Monads in Scala (1)
Introduction to Monads in Scala (1)stasimus
 
Introducción a Elixir
Introducción a ElixirIntroducción a Elixir
Introducción a ElixirSvet Ivantchev
 

Mais procurados (20)

One Monad to Rule Them All
One Monad to Rule Them AllOne Monad to Rule Them All
One Monad to Rule Them All
 
Python array
Python arrayPython array
Python array
 
Arrays in python
Arrays in pythonArrays in python
Arrays in python
 
Blazing Fast, Pure Effects without Monads — LambdaConf 2018
Blazing Fast, Pure Effects without Monads — LambdaConf 2018Blazing Fast, Pure Effects without Monads — LambdaConf 2018
Blazing Fast, Pure Effects without Monads — LambdaConf 2018
 
Haskell for data science
Haskell for data scienceHaskell for data science
Haskell for data science
 
Arrays in java
Arrays in javaArrays in java
Arrays in java
 
High-Performance Haskell
High-Performance HaskellHigh-Performance Haskell
High-Performance Haskell
 
Humble introduction to category theory in haskell
Humble introduction to category theory in haskellHumble introduction to category theory in haskell
Humble introduction to category theory in haskell
 
7 Habits For a More Functional Swift
7 Habits For a More Functional Swift7 Habits For a More Functional Swift
7 Habits For a More Functional Swift
 
Intro to Functional Programming
Intro to Functional ProgrammingIntro to Functional Programming
Intro to Functional Programming
 
Composition birds-and-recursion
Composition birds-and-recursionComposition birds-and-recursion
Composition birds-and-recursion
 
Functional programming with haskell
Functional programming with haskellFunctional programming with haskell
Functional programming with haskell
 
Java: Introduction to Arrays
Java: Introduction to ArraysJava: Introduction to Arrays
Java: Introduction to Arrays
 
Beginning Python
Beginning PythonBeginning Python
Beginning Python
 
Functional programming in Python
Functional programming in PythonFunctional programming in Python
Functional programming in Python
 
Talk Code
Talk CodeTalk Code
Talk Code
 
Java cheatsheet
Java cheatsheetJava cheatsheet
Java cheatsheet
 
Introduction to Monads in Scala (1)
Introduction to Monads in Scala (1)Introduction to Monads in Scala (1)
Introduction to Monads in Scala (1)
 
Python programming : Strings
Python programming : StringsPython programming : Strings
Python programming : Strings
 
Introducción a Elixir
Introducción a ElixirIntroducción a Elixir
Introducción a Elixir
 

Destaque

Teletraffic engineering handbook
Teletraffic engineering handbookTeletraffic engineering handbook
Teletraffic engineering handbookDeepak Singh
 
Lecture5 teletraffic
Lecture5 teletrafficLecture5 teletraffic
Lecture5 teletrafficmazlina1202
 
Teaching Students with Emojis, Emoticons, & Textspeak
Teaching Students with Emojis, Emoticons, & TextspeakTeaching Students with Emojis, Emoticons, & Textspeak
Teaching Students with Emojis, Emoticons, & TextspeakShelly Sanchez Terrell
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsLinkedIn
 
Hype vs. Reality: The AI Explainer
Hype vs. Reality: The AI ExplainerHype vs. Reality: The AI Explainer
Hype vs. Reality: The AI ExplainerLuminary Labs
 

Destaque (6)

Teletraffic engineering
Teletraffic engineeringTeletraffic engineering
Teletraffic engineering
 
Teletraffic engineering handbook
Teletraffic engineering handbookTeletraffic engineering handbook
Teletraffic engineering handbook
 
Lecture5 teletraffic
Lecture5 teletrafficLecture5 teletraffic
Lecture5 teletraffic
 
Teaching Students with Emojis, Emoticons, & Textspeak
Teaching Students with Emojis, Emoticons, & TextspeakTeaching Students with Emojis, Emoticons, & Textspeak
Teaching Students with Emojis, Emoticons, & Textspeak
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
 
Hype vs. Reality: The AI Explainer
Hype vs. Reality: The AI ExplainerHype vs. Reality: The AI Explainer
Hype vs. Reality: The AI Explainer
 

Semelhante a Erlang

Five Languages in a Moment
Five Languages in a MomentFive Languages in a Moment
Five Languages in a MomentSergio Gil
 
Architecting Scalable Platforms in Erlang/OTP | Hamidreza Soleimani | Diginex...
Architecting Scalable Platforms in Erlang/OTP | Hamidreza Soleimani | Diginex...Architecting Scalable Platforms in Erlang/OTP | Hamidreza Soleimani | Diginex...
Architecting Scalable Platforms in Erlang/OTP | Hamidreza Soleimani | Diginex...Hamidreza Soleimani
 
Introduction To Erlang Final
Introduction To Erlang   FinalIntroduction To Erlang   Final
Introduction To Erlang FinalSinarShebl
 
Erlang bootstrap course
Erlang bootstrap courseErlang bootstrap course
Erlang bootstrap courseMartin Logan
 
Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecLoïc Descotte
 
The secrets of inverse brogramming
The secrets of inverse brogrammingThe secrets of inverse brogramming
The secrets of inverse brogrammingRichie Cotton
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)Pavlo Baron
 
Elixir & Phoenix - fast, concurrent and explicit
Elixir & Phoenix - fast, concurrent and explicitElixir & Phoenix - fast, concurrent and explicit
Elixir & Phoenix - fast, concurrent and explicitTobias Pfeiffer
 
Intro To Erlang
Intro To ErlangIntro To Erlang
Intro To Erlangasceth
 
(first '(Clojure.))
(first '(Clojure.))(first '(Clojure.))
(first '(Clojure.))niklal
 
TDC2016SP - Trilha Programação Funcional
TDC2016SP - Trilha Programação FuncionalTDC2016SP - Trilha Programação Funcional
TDC2016SP - Trilha Programação Funcionaltdc-globalcode
 
Use Applicative where applicable!
Use Applicative where applicable!Use Applicative where applicable!
Use Applicative where applicable!Hermann Hueck
 
Geeks Anonymes - Le langage Go
Geeks Anonymes - Le langage GoGeeks Anonymes - Le langage Go
Geeks Anonymes - Le langage GoGeeks Anonymes
 

Semelhante a Erlang (20)

Five Languages in a Moment
Five Languages in a MomentFive Languages in a Moment
Five Languages in a Moment
 
Architecting Scalable Platforms in Erlang/OTP | Hamidreza Soleimani | Diginex...
Architecting Scalable Platforms in Erlang/OTP | Hamidreza Soleimani | Diginex...Architecting Scalable Platforms in Erlang/OTP | Hamidreza Soleimani | Diginex...
Architecting Scalable Platforms in Erlang/OTP | Hamidreza Soleimani | Diginex...
 
Introduction To Erlang Final
Introduction To Erlang   FinalIntroduction To Erlang   Final
Introduction To Erlang Final
 
Erlang bootstrap course
Erlang bootstrap courseErlang bootstrap course
Erlang bootstrap course
 
Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar Prokopec
 
The secrets of inverse brogramming
The secrets of inverse brogrammingThe secrets of inverse brogramming
The secrets of inverse brogramming
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)
 
Java
JavaJava
Java
 
Elixir & Phoenix - fast, concurrent and explicit
Elixir & Phoenix - fast, concurrent and explicitElixir & Phoenix - fast, concurrent and explicit
Elixir & Phoenix - fast, concurrent and explicit
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Monads in Swift
Monads in SwiftMonads in Swift
Monads in Swift
 
Elixir cheatsheet
Elixir cheatsheetElixir cheatsheet
Elixir cheatsheet
 
Intro To Erlang
Intro To ErlangIntro To Erlang
Intro To Erlang
 
(first '(Clojure.))
(first '(Clojure.))(first '(Clojure.))
(first '(Clojure.))
 
TDC2016SP - Trilha Programação Funcional
TDC2016SP - Trilha Programação FuncionalTDC2016SP - Trilha Programação Funcional
TDC2016SP - Trilha Programação Funcional
 
Haskell 101
Haskell 101Haskell 101
Haskell 101
 
Use Applicative where applicable!
Use Applicative where applicable!Use Applicative where applicable!
Use Applicative where applicable!
 
Practical cats
Practical catsPractical cats
Practical cats
 
Geeks Anonymes - Le langage Go
Geeks Anonymes - Le langage GoGeeks Anonymes - Le langage Go
Geeks Anonymes - Le langage Go
 
Rust Intro
Rust IntroRust Intro
Rust Intro
 

Erlang