SlideShare une entreprise Scribd logo
1  sur  20
Télécharger pour lire hors ligne
@alepoletto
What is/ Why?
•   Functional programming language.
•   Large emphasis on concurrency and high reliability
•   Erlang's runtime system has built-in support for concurrency,
    distribution and fault tolerance
•   Use the Actor Model
•   Used in telecoms, banking, e-commerce, computer telephony and
    instant messaging.
•   Runs inside a virtual machine.




                                          @alepoletto
Who created?




    @alepoletto
Reference to A. K. Erlang




           @alepoletto
Who is using




    @alepoletto
@alepoletto
Variables and Atoms
•   X = 2 + 2.
•   X = 4.
•   X = 7.
•   x = 4.     (can’t be lower case)


•   Lower case is reserved to atoms
•   Lets say that car is a atom.
•   Them car is a car nothing more.
•   Useful to express values

                             @alepoletto
Functions
soma(A, B) -> A+B.

ola() -> io:format(“Ola”).

olaSoma(A) -> ola(), soma(A,1).




                       @alepoletto
Modules
-module(society).
-export([soma/2]).
-compile(export_all).

soma(A, B) -> A+B.
ola() -> io:format(“Ola”).



                        @alepoletto
Pattern Matcher




      @alepoletto
Pattern Matching
function jovem(Pessoa)
  if Pessoa == chaves then
      print(“Jovem ainda”)
  else if Pessoa == madruga then
      print(“Velho”)
  else
      print(“Não sei")
end

                     @alepoletto
Pattern Matching
jovem(chaves) -> io:format(“Jovem ainda”);
jovem(madruga) -> io:format(“Velho”);
jovem(_) -> io:format(“Não Sei”).

adulto(X) when X >= 21 -> true;
adulto(_) -> false.



                     @alepoletto
Lets be Functional
fatorial(0) -> 1;
fatorial(N) -> when N > 0 -> N * fatorial(N-1).

map(_, []) -> [];
map(F, [H|T]) -> [F(H)|map(F,T)].
L = [1,2,3,4,5].
map(fun society:fatorial/1, L).
map(fun(X) -> X + 1 end, L).

                       @alepoletto
Actors




 @alepoletto
Actors
cobra() ->
  receive
      {From, speak} ->
            From ! “You're the disease, and I'm the
  cure.";
      {From, deal} ->
            From ! “I don't deal with psychos. I put them
  away. ";
      _ ->
            io:format(“no talk")
  end.

                         @alepoletto
Actors
Stallone = spawn(society, cobra, []).
<0.55.0>
Stallone! {self(), speak}.
flush().
"You're the disease, and I'm the cure. “
Stallone! {self(), danca}.
flush().

                      @alepoletto
Actors
cobra() ->
   receive
         {From, speak} ->
                 From ! “You're the disease, and I'm the cure."
                 cobra();
         {From, deal} ->
                 From ! “I don't deal with psychos. I put them away. "
                  cobra();
         _ ->
                 io:format(“no talk")
                 cobra();
   end.


                                @alepoletto
Actors
Stallone! {self(), speak}.
“You're the disease, and I'm the cure.“
 Stallone! {self(), deal}.
“I don't deal with psychos. I put them away. “
Stallone! {self(), shoot}.
“no talk”



                      @alepoletto
Reference
•   http://learnyousomeerlang.com/
•   http://www.erlang.org/
•   http://en.wikipedia.org/wiki/Erlang_(programming_language)




                                   @alepoletto
Thank You




   @alepoletto

Contenu connexe

Plus de Alexandre Poletto (6)

Node jslt
Node jsltNode jslt
Node jslt
 
LDC 5
LDC 5LDC 5
LDC 5
 
Lt hiccup
Lt hiccupLt hiccup
Lt hiccup
 
Qi4j
Qi4j Qi4j
Qi4j
 
Clojure - LDC
Clojure - LDCClojure - LDC
Clojure - LDC
 
Tecnologias
TecnologiasTecnologias
Tecnologias
 

Dernier

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Dernier (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

Erlang

  • 2. What is/ Why? • Functional programming language. • Large emphasis on concurrency and high reliability • Erlang's runtime system has built-in support for concurrency, distribution and fault tolerance • Use the Actor Model • Used in telecoms, banking, e-commerce, computer telephony and instant messaging. • Runs inside a virtual machine. @alepoletto
  • 3. Who created? @alepoletto
  • 4. Reference to A. K. Erlang @alepoletto
  • 5. Who is using @alepoletto
  • 7. Variables and Atoms • X = 2 + 2. • X = 4. • X = 7. • x = 4. (can’t be lower case) • Lower case is reserved to atoms • Lets say that car is a atom. • Them car is a car nothing more. • Useful to express values @alepoletto
  • 8. Functions soma(A, B) -> A+B. ola() -> io:format(“Ola”). olaSoma(A) -> ola(), soma(A,1). @alepoletto
  • 10. Pattern Matcher @alepoletto
  • 11. Pattern Matching function jovem(Pessoa) if Pessoa == chaves then print(“Jovem ainda”) else if Pessoa == madruga then print(“Velho”) else print(“Não sei") end @alepoletto
  • 12. Pattern Matching jovem(chaves) -> io:format(“Jovem ainda”); jovem(madruga) -> io:format(“Velho”); jovem(_) -> io:format(“Não Sei”). adulto(X) when X >= 21 -> true; adulto(_) -> false. @alepoletto
  • 13. Lets be Functional fatorial(0) -> 1; fatorial(N) -> when N > 0 -> N * fatorial(N-1). map(_, []) -> []; map(F, [H|T]) -> [F(H)|map(F,T)]. L = [1,2,3,4,5]. map(fun society:fatorial/1, L). map(fun(X) -> X + 1 end, L). @alepoletto
  • 15. Actors cobra() -> receive {From, speak} -> From ! “You're the disease, and I'm the cure."; {From, deal} -> From ! “I don't deal with psychos. I put them away. "; _ -> io:format(“no talk") end. @alepoletto
  • 16. Actors Stallone = spawn(society, cobra, []). <0.55.0> Stallone! {self(), speak}. flush(). "You're the disease, and I'm the cure. “ Stallone! {self(), danca}. flush(). @alepoletto
  • 17. Actors cobra() -> receive {From, speak} -> From ! “You're the disease, and I'm the cure." cobra(); {From, deal} -> From ! “I don't deal with psychos. I put them away. " cobra(); _ -> io:format(“no talk") cobra(); end. @alepoletto
  • 18. Actors Stallone! {self(), speak}. “You're the disease, and I'm the cure.“ Stallone! {self(), deal}. “I don't deal with psychos. I put them away. “ Stallone! {self(), shoot}. “no talk” @alepoletto
  • 19. Reference • http://learnyousomeerlang.com/ • http://www.erlang.org/ • http://en.wikipedia.org/wiki/Erlang_(programming_language) @alepoletto
  • 20. Thank You @alepoletto