SlideShare a Scribd company logo
Erlang Intro
Balaji G
History
● Joe Armstrong Invented Erlang (he is no more with us)
● Created in 1986 for ericsson telecom systems ,
● Open-sourced in 1998 by ericsson
● Achieved uptime 99.9% in telecom systems
5 Reasons to Learn Erlang By Author Joe
Here are five reasons why you should learn Erlang:
• You want to write programs that run faster when you run them on a multicore
computer.
• You want to write fault-tolerant applications that can be modified without taking them
out of service.
• You’ve heard about “functional programming” and you’re wondering whether the
techniques really work.
• You want to use a language that has been battle tested in real large-scale industrial
products that has great libraries and an active user community.
• You don’t want to wear your fingers out by typing lots of lines of code.
WHY ERLANG?
❖ There are so many programming Languages c, c++, java, python, ruby,
haskell, java, scala etc
❖ Scalability
❖ High Performance
❖ Fault Tolerance
❖ Concurrency
Things Created in Erlang
➔ Whatsapp
➔ RabbitMQ (Message Broker)
➔ Mnesia
➔ RIAK Database (No SQL, Key- value data store)
➔ Ejabberd
Installation
sudo apt-get install erlang
Starting Erlang Shell
bala@bala:~$ erl
Erlang/OTP 21 [erts-10.2.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1]
Eshell V10.2.4 (abort with ^G)
1>
q(). % to quit erl shell
Cntl + G to abort shell
i interrupt current shel
j list current shell details
Lets See Some Arithmetic
Operations
1> 5/3.
1.66667
2> 4/2.
2.00000
3> 5 div 3.
1
4> 5 rem 3.
2
5> 4 div 2.
2
Basic Operations
6> Pi = 3.14159.
3.14159
7>R = 5.
5
8> Pi * R * R.
78.5397
Variables
1. Should be Start with UPPER CASE Letter
2. Once assigned Value that can’t be changed .
3. (e.x) X = 10 , you can’t change the value of X into something else
4. Erlang Strictly follows Mathematics L.H.S = R.H.S
5. X = 6.
6. X = 4+ 2.
7. X = 10.
** exception error: no match of right hand side value 10
Atoms
Atoms Used to represent non numerical constants in Erlang , similar to
enumerated constants in C language
# define OP_READ 1
1> hello.
hello
2> monday.
monday
3>
Tuples
● Group fixed number of items in to a single entity , it is similar to struct in c
● In C Struct Point {
Int x,
Int y;
} P;
● P = {10, 45} % it denotes the Point X, Y
● In Erlang , the is no type declarations .
1>Person ={person, {name, bala}, {height, 5.4}, {eyecolor, brown}}.
{person,{name,bala},{height,5.4},{eyecolor,brown}}
Extracting Values from Tuples
Point = {point, 10, 45}.
{point, X, Y} = Point.
3> X.
10
4> Y.
45
Pattern Matching in detail
Eshell V10.2.4 (abort with ^G)
1> Person ={person, {name, bala}, {height, 5.4}, {eyecolor, brown}}.
{person,{name,bala},{height,5.4},{eyecolor,brown}}
2> {_,{_, Who}, _, _} = Person.
{person,{name,bala},{height,5.4},{eyecolor,brown}}
3> Who.
bala
hyphen(_) is called “Anonymous variable” in Erlang . It’s like a placeholder we are
not interested in it or don’t want the values of those.
Lists
1>L = [1,2,3,4,5].
● First element of the list is called “Head”
● Rest of the elements in list called “Tail” (This always should be list)
● Reading Head in O(1) , it’s always efficient in Erlang
● In Erlang we always pick head , and do operation
● [Head, Tail] = L.
● Head.
1
● Tail.
[2,3,4,5]
List Inbuilt Operations
4> L = [1,3,4,5].
[1,3,4,5]
5> lists:sum(L).
13
6> lists:max(L).
5
7> lists:min(L).
1
List Comprehensions
1> [2*N || N <- [1,2,3,4]].
[2,4,6,8]
2> [X || X <- [1,2,3,4,5,6,7,8,9,10], X rem 2 =:= 0].
[2,4,6,8,10]
3> [X+Y || X <- [1,2], Y <- [3,4]].
[4,5,5,6]
Strings
● String are enclosed in double quotes in Erlang (“) , Note in other
programming string can be single or double quotes but in erlang only double
quotes.
● > Name = “Balaji”.
“Balaji”
● Literally there are no strings in erlang it’s just a numbers in erlang
● To know which integer represents which character use dollar syntax
● 1> $a.
97
Does That Mean Erlang is Poor in String
Processing?
● Don’t lose hope , Erlang factory is an organisation has
created an “Artifical Intelligence “ for Robots in Erlang .
●
Hello World In Erlang
-module(hello).
-export([hello/0]).
hello() -> io:fwrite("Hello World!").
Compiling and Running Erlang Code
bala@bala:~/erlcodes/codes/othercodes$ erl
Erlang/OTP 21 [erts-10.2.4] [source] [64-bit] [smp:4:4]
[ds:4:4:10] [async-threads:1]
Eshell V10.2.4 (abort with ^G)
1> c(hello).
{ok,hello}
2> hello:hello().
Hello World!ok
Factorial Program in Erlang
-module(fac).
-export([fac/1]).
fac(0) -> 1;
fac(N) -> N*fac(N-1).
1> c(fac).
{ok, fac}
2> fac:fac(5).
120
Books to Learn Erlang
● Programming Erlang By “Joe Armstrong” (Creator of
Erlang)
● Learn You Some Erlang By “Fred Hebret”
● Erlang and OTP in Action by “Martin Logan”
Questions ?
Thanks !!!

More Related Content

What's hot

Scheme Programming Language
Scheme Programming LanguageScheme Programming Language
Scheme Programming Language
Reham AlBlehid
 
Review Python
Review PythonReview Python
Review Python
ManishTiwari326
 
Python Data Types
Python Data TypesPython Data Types
Python Data Types
athithanvijay
 
Definitions of Functional Programming
Definitions of Functional ProgrammingDefinitions of Functional Programming
Definitions of Functional Programming
Philip Schwarz
 
Introduction to Python programming Language
Introduction to Python programming LanguageIntroduction to Python programming Language
Introduction to Python programming Language
MansiSuthar3
 
Python programming
Python programmingPython programming
Python programming
saroja20
 
Frequently asked questions in c
Frequently asked questions in cFrequently asked questions in c
Frequently asked questions in c
David Livingston J
 
Python revision tour II
Python revision tour IIPython revision tour II
Python revision tour II
Mr. Vikram Singh Slathia
 
Python-01| Fundamentals
Python-01| FundamentalsPython-01| Fundamentals
Python-01| Fundamentals
Mohd Sajjad
 
Data Structure
Data StructureData Structure
Data Structure
sheraz1
 
Introduction To Programming with Python-4
Introduction To Programming with Python-4Introduction To Programming with Python-4
Introduction To Programming with Python-4
Syed Farjad Zia Zaidi
 
Python programming
Python programmingPython programming
Python programming
saroja20
 
Frequently asked questions in c
Frequently asked questions in cFrequently asked questions in c
Frequently asked questions in c
David Livingston J
 
Fuzzy Logic
Fuzzy LogicFuzzy Logic
pyton Notes6
 pyton Notes6 pyton Notes6
pyton Notes6
Amba Research
 
pyton Notes9
pyton Notes9pyton Notes9
pyton Notes9
Amba Research
 
Scheme language
Scheme languageScheme language
Scheme language
JITENDRA LENKA
 
Algorithm and pseudocode conventions
Algorithm and pseudocode conventionsAlgorithm and pseudocode conventions
Algorithm and pseudocode conventions
saranyatdr
 
Chapter 9 python fundamentals
Chapter 9 python fundamentalsChapter 9 python fundamentals
Chapter 9 python fundamentals
Praveen M Jigajinni
 
Arranging the words of a text lexicographically trie
Arranging the words of a text lexicographically   trieArranging the words of a text lexicographically   trie
Arranging the words of a text lexicographically trie
Somenath Mukhopadhyay
 

What's hot (20)

Scheme Programming Language
Scheme Programming LanguageScheme Programming Language
Scheme Programming Language
 
Review Python
Review PythonReview Python
Review Python
 
Python Data Types
Python Data TypesPython Data Types
Python Data Types
 
Definitions of Functional Programming
Definitions of Functional ProgrammingDefinitions of Functional Programming
Definitions of Functional Programming
 
Introduction to Python programming Language
Introduction to Python programming LanguageIntroduction to Python programming Language
Introduction to Python programming Language
 
Python programming
Python programmingPython programming
Python programming
 
Frequently asked questions in c
Frequently asked questions in cFrequently asked questions in c
Frequently asked questions in c
 
Python revision tour II
Python revision tour IIPython revision tour II
Python revision tour II
 
Python-01| Fundamentals
Python-01| FundamentalsPython-01| Fundamentals
Python-01| Fundamentals
 
Data Structure
Data StructureData Structure
Data Structure
 
Introduction To Programming with Python-4
Introduction To Programming with Python-4Introduction To Programming with Python-4
Introduction To Programming with Python-4
 
Python programming
Python programmingPython programming
Python programming
 
Frequently asked questions in c
Frequently asked questions in cFrequently asked questions in c
Frequently asked questions in c
 
Fuzzy Logic
Fuzzy LogicFuzzy Logic
Fuzzy Logic
 
pyton Notes6
 pyton Notes6 pyton Notes6
pyton Notes6
 
pyton Notes9
pyton Notes9pyton Notes9
pyton Notes9
 
Scheme language
Scheme languageScheme language
Scheme language
 
Algorithm and pseudocode conventions
Algorithm and pseudocode conventionsAlgorithm and pseudocode conventions
Algorithm and pseudocode conventions
 
Chapter 9 python fundamentals
Chapter 9 python fundamentalsChapter 9 python fundamentals
Chapter 9 python fundamentals
 
Arranging the words of a text lexicographically trie
Arranging the words of a text lexicographically   trieArranging the words of a text lexicographically   trie
Arranging the words of a text lexicographically trie
 

Similar to Erlang

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
 
Erlang kickstart
Erlang kickstartErlang kickstart
Erlang kickstart
Ryan Brown
 
Introduction to Erlang
Introduction to ErlangIntroduction to Erlang
Introduction to Erlang
Raymond Tay
 
Introduction to Erlang Part 1
Introduction to Erlang Part 1Introduction to Erlang Part 1
Introduction to Erlang Part 1
Dmitry Zinoviev
 
Python lab basics
Python lab basicsPython lab basics
Python lab basics
Abi_Kasi
 
Erlang, an overview
Erlang, an overviewErlang, an overview
Erlang, an overview
Patrick Huesler
 
CPPDS Slide.pdf
CPPDS Slide.pdfCPPDS Slide.pdf
CPPDS Slide.pdf
Fadlie Ahdon
 
Erlang intro
Erlang introErlang intro
Erlang intro
SSA KPI
 
Automation Testing theory notes.pptx
Automation Testing theory notes.pptxAutomation Testing theory notes.pptx
Automation Testing theory notes.pptx
NileshBorkar12
 
Get started python programming part 1
Get started python programming   part 1Get started python programming   part 1
Get started python programming part 1
Nicholas I
 
Python week 6 2019 2020 for grade 10
Python week 6 2019 2020 for grade 10 Python week 6 2019 2020 for grade 10
Python week 6 2019 2020 for grade 10
Osama Ghandour Geris
 
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
DRVaibhavmeshram1
 
Cs3430 lecture 15
Cs3430 lecture 15Cs3430 lecture 15
Cs3430 lecture 15
Tanwir Zaman
 
Erlang session1
Erlang session1Erlang session1
Erlang session1
mohamedsamyali
 
Basic of Python- Hands on Session
Basic of Python- Hands on SessionBasic of Python- Hands on Session
Basic of Python- Hands on Session
Dharmesh Tank
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Ahmed Salama
 
R-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdfR-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdf
KabilaArun
 
R-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdfR-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdf
DrGSakthiGovindaraju
 
R-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdfR-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdf
attalurilalitha
 
Functional Programming.pptx
Functional Programming.pptxFunctional Programming.pptx
Functional Programming.pptx
KarthickT28
 

Similar to Erlang (20)

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...
 
Erlang kickstart
Erlang kickstartErlang kickstart
Erlang kickstart
 
Introduction to Erlang
Introduction to ErlangIntroduction to Erlang
Introduction to Erlang
 
Introduction to Erlang Part 1
Introduction to Erlang Part 1Introduction to Erlang Part 1
Introduction to Erlang Part 1
 
Python lab basics
Python lab basicsPython lab basics
Python lab basics
 
Erlang, an overview
Erlang, an overviewErlang, an overview
Erlang, an overview
 
CPPDS Slide.pdf
CPPDS Slide.pdfCPPDS Slide.pdf
CPPDS Slide.pdf
 
Erlang intro
Erlang introErlang intro
Erlang intro
 
Automation Testing theory notes.pptx
Automation Testing theory notes.pptxAutomation Testing theory notes.pptx
Automation Testing theory notes.pptx
 
Get started python programming part 1
Get started python programming   part 1Get started python programming   part 1
Get started python programming part 1
 
Python week 6 2019 2020 for grade 10
Python week 6 2019 2020 for grade 10 Python week 6 2019 2020 for grade 10
Python week 6 2019 2020 for grade 10
 
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
 
Cs3430 lecture 15
Cs3430 lecture 15Cs3430 lecture 15
Cs3430 lecture 15
 
Erlang session1
Erlang session1Erlang session1
Erlang session1
 
Basic of Python- Hands on Session
Basic of Python- Hands on SessionBasic of Python- Hands on Session
Basic of Python- Hands on Session
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
R-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdfR-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdf
 
R-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdfR-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdf
 
R-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdfR-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdf
 
Functional Programming.pptx
Functional Programming.pptxFunctional Programming.pptx
Functional Programming.pptx
 

Recently uploaded

ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.
Maitrey Patel
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
The Third Creative Media
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
ShulagnaSarkar2
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Paul Brebner
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
Peter Muessig
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
kalichargn70th171
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
gapen1
 
Project Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdfProject Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdf
Karya Keeper
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
dakas1
 
Quarter 3 SLRP grade 9.. gshajsbhhaheabh
Quarter 3 SLRP grade 9.. gshajsbhhaheabhQuarter 3 SLRP grade 9.. gshajsbhhaheabh
Quarter 3 SLRP grade 9.. gshajsbhhaheabh
aisafed42
 

Recently uploaded (20)

ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
 
Project Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdfProject Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdf
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
 
Quarter 3 SLRP grade 9.. gshajsbhhaheabh
Quarter 3 SLRP grade 9.. gshajsbhhaheabhQuarter 3 SLRP grade 9.. gshajsbhhaheabh
Quarter 3 SLRP grade 9.. gshajsbhhaheabh
 

Erlang

  • 2. History ● Joe Armstrong Invented Erlang (he is no more with us) ● Created in 1986 for ericsson telecom systems , ● Open-sourced in 1998 by ericsson ● Achieved uptime 99.9% in telecom systems
  • 3. 5 Reasons to Learn Erlang By Author Joe Here are five reasons why you should learn Erlang: • You want to write programs that run faster when you run them on a multicore computer. • You want to write fault-tolerant applications that can be modified without taking them out of service. • You’ve heard about “functional programming” and you’re wondering whether the techniques really work. • You want to use a language that has been battle tested in real large-scale industrial products that has great libraries and an active user community. • You don’t want to wear your fingers out by typing lots of lines of code.
  • 4. WHY ERLANG? ❖ There are so many programming Languages c, c++, java, python, ruby, haskell, java, scala etc ❖ Scalability ❖ High Performance ❖ Fault Tolerance ❖ Concurrency
  • 5. Things Created in Erlang ➔ Whatsapp ➔ RabbitMQ (Message Broker) ➔ Mnesia ➔ RIAK Database (No SQL, Key- value data store) ➔ Ejabberd
  • 7. Starting Erlang Shell bala@bala:~$ erl Erlang/OTP 21 [erts-10.2.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] Eshell V10.2.4 (abort with ^G) 1> q(). % to quit erl shell Cntl + G to abort shell i interrupt current shel j list current shell details
  • 8. Lets See Some Arithmetic Operations
  • 9. 1> 5/3. 1.66667 2> 4/2. 2.00000 3> 5 div 3. 1 4> 5 rem 3. 2 5> 4 div 2. 2 Basic Operations 6> Pi = 3.14159. 3.14159 7>R = 5. 5 8> Pi * R * R. 78.5397
  • 10. Variables 1. Should be Start with UPPER CASE Letter 2. Once assigned Value that can’t be changed . 3. (e.x) X = 10 , you can’t change the value of X into something else 4. Erlang Strictly follows Mathematics L.H.S = R.H.S 5. X = 6. 6. X = 4+ 2. 7. X = 10. ** exception error: no match of right hand side value 10
  • 11. Atoms Atoms Used to represent non numerical constants in Erlang , similar to enumerated constants in C language # define OP_READ 1 1> hello. hello 2> monday. monday 3>
  • 12. Tuples ● Group fixed number of items in to a single entity , it is similar to struct in c ● In C Struct Point { Int x, Int y; } P; ● P = {10, 45} % it denotes the Point X, Y ● In Erlang , the is no type declarations . 1>Person ={person, {name, bala}, {height, 5.4}, {eyecolor, brown}}. {person,{name,bala},{height,5.4},{eyecolor,brown}}
  • 13. Extracting Values from Tuples Point = {point, 10, 45}. {point, X, Y} = Point. 3> X. 10 4> Y. 45
  • 14. Pattern Matching in detail Eshell V10.2.4 (abort with ^G) 1> Person ={person, {name, bala}, {height, 5.4}, {eyecolor, brown}}. {person,{name,bala},{height,5.4},{eyecolor,brown}} 2> {_,{_, Who}, _, _} = Person. {person,{name,bala},{height,5.4},{eyecolor,brown}} 3> Who. bala hyphen(_) is called “Anonymous variable” in Erlang . It’s like a placeholder we are not interested in it or don’t want the values of those.
  • 15. Lists 1>L = [1,2,3,4,5]. ● First element of the list is called “Head” ● Rest of the elements in list called “Tail” (This always should be list) ● Reading Head in O(1) , it’s always efficient in Erlang ● In Erlang we always pick head , and do operation ● [Head, Tail] = L. ● Head. 1 ● Tail. [2,3,4,5]
  • 16. List Inbuilt Operations 4> L = [1,3,4,5]. [1,3,4,5] 5> lists:sum(L). 13 6> lists:max(L). 5 7> lists:min(L). 1
  • 17. List Comprehensions 1> [2*N || N <- [1,2,3,4]]. [2,4,6,8] 2> [X || X <- [1,2,3,4,5,6,7,8,9,10], X rem 2 =:= 0]. [2,4,6,8,10] 3> [X+Y || X <- [1,2], Y <- [3,4]]. [4,5,5,6]
  • 18. Strings ● String are enclosed in double quotes in Erlang (“) , Note in other programming string can be single or double quotes but in erlang only double quotes. ● > Name = “Balaji”. “Balaji” ● Literally there are no strings in erlang it’s just a numbers in erlang ● To know which integer represents which character use dollar syntax ● 1> $a. 97
  • 19. Does That Mean Erlang is Poor in String Processing? ● Don’t lose hope , Erlang factory is an organisation has created an “Artifical Intelligence “ for Robots in Erlang . ●
  • 20. Hello World In Erlang -module(hello). -export([hello/0]). hello() -> io:fwrite("Hello World!").
  • 21. Compiling and Running Erlang Code bala@bala:~/erlcodes/codes/othercodes$ erl Erlang/OTP 21 [erts-10.2.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] Eshell V10.2.4 (abort with ^G) 1> c(hello). {ok,hello} 2> hello:hello(). Hello World!ok
  • 22. Factorial Program in Erlang -module(fac). -export([fac/1]). fac(0) -> 1; fac(N) -> N*fac(N-1). 1> c(fac). {ok, fac} 2> fac:fac(5). 120
  • 23. Books to Learn Erlang ● Programming Erlang By “Joe Armstrong” (Creator of Erlang) ● Learn You Some Erlang By “Fred Hebret” ● Erlang and OTP in Action by “Martin Logan”