SlideShare a Scribd company logo
AN INTRODUCTION TO
ERLANG AND ELIXIR
Wednesday, September 25, 13
WHAT IS ERLANG
Modular, Declarative Language who’s syntax descends from
prolog
Wednesday, September 25, 13
WHAT IS ELIXIR
Modular, Declarative language with meta programming
facilities whose syntax descends (mostly) from Ruby
Wednesday, September 25, 13
ERLANG VM - WHY SO
INTERESTING
Built Around Concurrency
Built in scheduler
Async IO
Concurrent Garbage collector
Wednesday, September 25, 13
ERLANG VM - WHY SO
INTERESTING
Small Number of Serializable Types
Pattern Matching
Processes
Process Linking
Immutable Data
Wednesday, September 25, 13
ERLANG VM
Erlang
Elixir
Joxa
LFE
The Concurrent Schemer
Reia
Wednesday, September 25, 13
ERLANG VM - TYPES
Numbers
Atoms
Bit Strings and Binaries
Fun
Tuple
List
Wednesday, September 25, 13
ERLANG VM -
FEATURES
Expressions
Functions
Modules
Process
Wednesday, September 25, 13
RECORDS - ERLANG
-module(records).
-record(robot, {name,
type=industrial,
hobbies,
details=[]}).
first_robot() ->
#robot{name="Mechatron",
type=handmade,
details=["Moved by a small man inside"]}.
Wednesday, September 25, 13
RECORDS - ELIXIR
defmodule Records do
defrecord Robots, name: nil,
type: industrial,
hobbies: nil,
details: ["Moved by a small man inside"]
def first_robot do
Robot.new(name: "Mechatron",
type: :handmade,
details: ["Moved by a small man inside"])
end
end
Wednesday, September 25, 13
POLYMORPHISM -
ELIXIR
defprotocol Blank do
@doc "Returns true if data is considered blank/empty"
def blank?(data)
end
# Numbers are never blank
defimpl Blank, for: Number do
def blank?(_), do: false
end
# Just empty list is blank
defimpl Blank, for: List do
def blank?([]), do: true
def blank?(_), do: false
end
# Just the atoms false and nil are blank
defimpl Blank, for: Atom do
def blank?(false), do: true
def blank?(nil), do: true
def blank?(_), do: false
end
Wednesday, September 25, 13
METAPROGRAMMING -
ELIXIR
defmodule MyMacro do
defmacro unless(clause, options) do
quote do: if(!unquote(clause), unquote(options))
end
end
require MyMacro
unless 2 + 2 == 5, do: call_function()
Wednesday, September 25, 13
DOWNSIDES - ERLANG
No Metaprogramming
No Polymorphism (mostly)
Obscure Syntax
Records are horrible
Wednesday, September 25, 13
DOWNSIDES - ELIXIR
Its young, so changes a fair amount
Truthiness is the devil
Macros are not sufficiently flexible (as what I am used to in
lisp)
Awkward syntax
Fair amount of inconsistency
Not really accepted by Erlangers
Wednesday, September 25, 13
UPSIDES - ERLANG
Simple, Regular Syntax
Stable - Infrequent Changes
Robust and Extraordinarily well tested
Wednesday, September 25, 13
UPSIDES - ELIXIR
Metaprogramming, Metaprogramming, Metaprogramming
Polymorphism
Non stable (ie, improving) syntax
Robust, usable shell
Did I say metaprogramming
Wednesday, September 25, 13
WRAPPING UP
Rate This Talk - http://speakerrate.com/talks/26081-an-
introduction-to-erlang-elixir-eric-merritt
Contact me - @ericbmerritt, ericbmerritt@gmail.com,
Wednesday, September 25, 13

More Related Content

PDF
Erlang, LFE, Joxa and Elixir: Established and Emerging Languages in the Erlan...
PDF
Coordinating European training and ELIXIR UK by Rita Hendricusdottir
PDF
The ELIXIR UK training portal (TeSS) by Carole Goble
PPTX
TeSS: ELIXIR Training Portal (Eubic Winter School 2017)
PPTX
ELIXIR-UK
PPTX
ELIXIR-UK and the ELIXIR Interoperability Platform
PPTX
Enfermedades raras
PPTX
Growing ELIXIR-UK
Erlang, LFE, Joxa and Elixir: Established and Emerging Languages in the Erlan...
Coordinating European training and ELIXIR UK by Rita Hendricusdottir
The ELIXIR UK training portal (TeSS) by Carole Goble
TeSS: ELIXIR Training Portal (Eubic Winter School 2017)
ELIXIR-UK
ELIXIR-UK and the ELIXIR Interoperability Platform
Enfermedades raras
Growing ELIXIR-UK

Viewers also liked (20)

PPTX
Enfermedades RARAS
PDF
Functional Programming With Elixir
PDF
Elixir
PPT
Las Enfermedades Raras
PDF
Introducción a las Enfermedades Raras - 27.03.2015
PPT
Enfermedades raras II
PDF
PPT
La Estrategia en Enfermedades Raras del SNS
PDF
¿Qué son las Enfermedades Raras?
PDF
Enfermedades Raras y Crónicas
PPTX
Medición en salud
PPTX
Validacion de escalas de medicion en salud
PPT
Enfermedades raras i
PPT
Medicamentos huérfanos
PPTX
Enfermedades raras
PPTX
Enfermedades raras
PPT
L A E P I D E M I O L O G I A C L A S E S
PPT
mortalidad materna brasil introduccion_lozano_120210_ihme
PPTX
secuenciación por el medoto de sanger
PPTX
Secuenciación del ADN - Lectura del adn de los organismos
Enfermedades RARAS
Functional Programming With Elixir
Elixir
Las Enfermedades Raras
Introducción a las Enfermedades Raras - 27.03.2015
Enfermedades raras II
La Estrategia en Enfermedades Raras del SNS
¿Qué son las Enfermedades Raras?
Enfermedades Raras y Crónicas
Medición en salud
Validacion de escalas de medicion en salud
Enfermedades raras i
Medicamentos huérfanos
Enfermedades raras
Enfermedades raras
L A E P I D E M I O L O G I A C L A S E S
mortalidad materna brasil introduccion_lozano_120210_ihme
secuenciación por el medoto de sanger
Secuenciación del ADN - Lectura del adn de los organismos
Ad

Recently uploaded (20)

DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Cloud computing and distributed systems.
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Approach and Philosophy of On baking technology
PPT
Teaching material agriculture food technology
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
The AUB Centre for AI in Media Proposal.docx
Cloud computing and distributed systems.
Spectral efficient network and resource selection model in 5G networks
Mobile App Security Testing_ A Comprehensive Guide.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Approach and Philosophy of On baking technology
Teaching material agriculture food technology
Building Integrated photovoltaic BIPV_UPV.pdf
Assigned Numbers - 2025 - Bluetooth® Document
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Programs and apps: productivity, graphics, security and other tools
MIND Revenue Release Quarter 2 2025 Press Release
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
sap open course for s4hana steps from ECC to s4
Agricultural_Statistics_at_a_Glance_2022_0.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
MYSQL Presentation for SQL database connectivity
Encapsulation_ Review paper, used for researhc scholars
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Ad

An introduction to Erlang and Elixir

  • 1. AN INTRODUCTION TO ERLANG AND ELIXIR Wednesday, September 25, 13
  • 2. WHAT IS ERLANG Modular, Declarative Language who’s syntax descends from prolog Wednesday, September 25, 13
  • 3. WHAT IS ELIXIR Modular, Declarative language with meta programming facilities whose syntax descends (mostly) from Ruby Wednesday, September 25, 13
  • 4. ERLANG VM - WHY SO INTERESTING Built Around Concurrency Built in scheduler Async IO Concurrent Garbage collector Wednesday, September 25, 13
  • 5. ERLANG VM - WHY SO INTERESTING Small Number of Serializable Types Pattern Matching Processes Process Linking Immutable Data Wednesday, September 25, 13
  • 6. ERLANG VM Erlang Elixir Joxa LFE The Concurrent Schemer Reia Wednesday, September 25, 13
  • 7. ERLANG VM - TYPES Numbers Atoms Bit Strings and Binaries Fun Tuple List Wednesday, September 25, 13
  • 9. RECORDS - ERLANG -module(records). -record(robot, {name, type=industrial, hobbies, details=[]}). first_robot() -> #robot{name="Mechatron", type=handmade, details=["Moved by a small man inside"]}. Wednesday, September 25, 13
  • 10. RECORDS - ELIXIR defmodule Records do defrecord Robots, name: nil, type: industrial, hobbies: nil, details: ["Moved by a small man inside"] def first_robot do Robot.new(name: "Mechatron", type: :handmade, details: ["Moved by a small man inside"]) end end Wednesday, September 25, 13
  • 11. POLYMORPHISM - ELIXIR defprotocol Blank do @doc "Returns true if data is considered blank/empty" def blank?(data) end # Numbers are never blank defimpl Blank, for: Number do def blank?(_), do: false end # Just empty list is blank defimpl Blank, for: List do def blank?([]), do: true def blank?(_), do: false end # Just the atoms false and nil are blank defimpl Blank, for: Atom do def blank?(false), do: true def blank?(nil), do: true def blank?(_), do: false end Wednesday, September 25, 13
  • 12. METAPROGRAMMING - ELIXIR defmodule MyMacro do defmacro unless(clause, options) do quote do: if(!unquote(clause), unquote(options)) end end require MyMacro unless 2 + 2 == 5, do: call_function() Wednesday, September 25, 13
  • 13. DOWNSIDES - ERLANG No Metaprogramming No Polymorphism (mostly) Obscure Syntax Records are horrible Wednesday, September 25, 13
  • 14. DOWNSIDES - ELIXIR Its young, so changes a fair amount Truthiness is the devil Macros are not sufficiently flexible (as what I am used to in lisp) Awkward syntax Fair amount of inconsistency Not really accepted by Erlangers Wednesday, September 25, 13
  • 15. UPSIDES - ERLANG Simple, Regular Syntax Stable - Infrequent Changes Robust and Extraordinarily well tested Wednesday, September 25, 13
  • 16. UPSIDES - ELIXIR Metaprogramming, Metaprogramming, Metaprogramming Polymorphism Non stable (ie, improving) syntax Robust, usable shell Did I say metaprogramming Wednesday, September 25, 13
  • 17. WRAPPING UP Rate This Talk - http://speakerrate.com/talks/26081-an- introduction-to-erlang-elixir-eric-merritt Contact me - @ericbmerritt, ericbmerritt@gmail.com, Wednesday, September 25, 13