SlideShare a Scribd company logo
# my_script.exs
defmodule MyModule do
def my_func do
IO.puts("Hello, world!")
end
end
MyModule.my_func()
gmile@macbook ~> elixir my_script
Hello, world!
gmile@macbook ~> iex
iex(1)> c “my_script.exs”
[MyModule]
iex(1)> MyModule.my_func
"Hello, world!”
:ok
defmodule MyModule do
def my_func(1), do: "Got one!"
def my_func(2), do: "Got two!"
def my_func(n), do: "Got #{n}!"
end
IO.puts(MyModule.my_func(10))
IO.puts(MyModule.my_func(5))
IO.puts(MyModule.my_func(2))
IO.puts(MyModule.my_func(1))
defmodule MyModule do
def my_func(1), do: "Got one!"
def my_func(2), do: "Got two!"
def my_func(n), do: "Got #{n}!"
end
MyModule.my_func(10) |> IO.puts
MyModule.my_func(5) |> IO.puts
MyModule.my_func(2) |> IO.puts
MyModule.my_func(1) |> IO.puts
defmodule MyModule do
def my_func(a_thing) when is_list(a_thing) do
"Got a list!”
end
def my_func(a_thing) when is_integer(a_thing) do
"Got a number!”
end
def my_func(_)
"Got something else!”
end
end
MyModule.my_func([1,2,3]) # => “Got a list!”
MyModule.my_func(369) # => “Got a number!”
MyModule.my_func(“yo”) # => “Got something else!”
defmodule MyModule do
def match_a_list([head|tail]) do
IO.puts(“First element is #{head}!”)
end
end
defmodule MyModule do
def match_a_list([one, two|tail]) do
IO.puts(“First element is #{one}!”)
IO.puts(“Second element is #{two}!”)
match_a_list(tail)
end
end
defmodule MyModule do
def match_a_list([]) do
IO.puts(“A list is empty!”)
end
def match_a_list([one, two|tail]) do
IO.puts(“First element is #{one}!”)
IO.puts(“Second element is #{two}!”)
match_a_list(tail)
end
end
defmodule MyModule do
def match_a_list([one, two|tail]) do
IO.puts(“First element is #{one}!”)
IO.puts(“Second element is #{two}!”)
end
end
defmodule MyModule do
def match_a_list([{_,b,_}|tail]) do
IO.puts(“First element is a tuple”)
IO.puts(“Tuple’s second element is #{b}”)
end
end
defmodule MyModule do
def match_a_list([t = {_,b,_}|tail]) do
IO.puts(“First element is a tuple of size 3”)
IO.puts(“Tuple’ss second element is #{b}”)
end
end
defmodule Anagram do
def match(base, candidates) do
base_ = String.downcase(base)
fingerprint = fingerprint(base_)
Enum.filter(candidates, fn(candidate) ->
cand_ = String.downcase(candidate)
cand_ != base_ && fingerprint(cand_) == fingerprint
end)
end
def fingerprint(string) do
string
|> String.codepoints
|> Enum.sort
end
end
Origins of Elixir programming language
Kyiv, July 2016
Introduction to

Elixir & Erlang
VM
Kiev, 2016
Erlang.
Brief history and facts
Erlang VM.
An overview of languages on BEAM
Elixir.
Brief history and ecosystem overview
Origins of Elixir programming language
Who created
Erlang?
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
Who uses Erlang
in production?
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
How old is
erlang?
Origins of Elixir programming language
version 1.03
“lost in
the mists of time”
version 1.06
dated 1986-12-18
Who supports
erlang today?
Origins of Elixir programming language
Origins of Elixir programming language
How many
packages
are there?
470!
What are some of
the most popular
libs/projects?
Origins of Elixir programming language
How many
popular projects
are there, per
GitHub?
Origins of Elixir programming language
What exactly
erlang is?
erlang
a mathematician
a measurement unit
a programming language
erlang
the language itself (syntax)
the OTP framework
the virtual machine
-module(hello).
-export([hello_world/0]).
hello_world() ->
io:fwrite("hello, worldn").
Eshell V8.0.1 (abort with ^G)
1> c(hello).
{ok,hello}
2> hello:hello_world().
hello, world
ok
-module(count_to_ten).
-export([count_to_ten/0]).
count_to_ten() -> do_count(0).
do_count(10) ->
10;
do_count(Value) ->
do_count(Value + 1).
Open
Telecom
Platform
OTP
~~~ It’s a framework ~~~
a set of design principles
a set of tools
Origins of Elixir programming language
BEAM
What is
BEAM?
BEAM
a name for virtual machine
binary file format
file extension, e.g. .beam
Before BEAM
Warren Abstract Machine, WAM
Joe’s Abstract Machine, JAM
Bogdan's Erlang Abstract Machine
Bogdan/Björn's
Erlang Abstract
Machine
Current version
is R19
Line numbers
in exceptions,
woohoo!!!
Origins of Elixir programming language
What kind of
virtual machine
BEAM is?
What is M in
VM?
Origins of Elixir programming language
Origins of Elixir programming language
{module, add}. %% version = 0
{exports, [{add,2},{module_info,0},{module_info,1}]}.
{attributes, []}.
{labels, 9}.
{function, add, 2, 2}.
{label,1}.
{line,[{location,"add.erl",6}]}.
{func_info,{atom,add},{atom,add},2}.
{label,2}.
{allocate,1,2}.
{move,{x,1},{y,0}}.
{line,[{location,"add.erl",7}]}.
{call,1,{f,4}}.
{move,{x,0},{x,1}}.
{move,{y,0},{x,0}}.
{move,{x,1},{y,0}}.
{line,[{location,"add.erl",7}]}.
{call,1,{f,4}}.
{line,[{location,"add.erl",7}]}.
{gc_bif,'+',{f,0},1,[{y,0},{x,0}],{x,0}}.
{deallocate,1}.
return.
{function, id, 1, 4}.
{label,3}.
{line,[{location,"add.erl",9}]}.
{func_info,{atom,add},{atom,id},1}.
{label,4}.
return.
{function, module_info, 0, 6}.
{label,5}.
{line,[]}.
{func_info,{atom,add},{atom,module_info},0}.
{label,6}.
{move,{atom,add},{x,0}}.
{line,[]}.
{call_ext_only,1,{extfunc,erlang,get_module_info,1}}.
{function, module_info, 1, 8}.
{label,7}.
{line,[]}.
{func_info,{atom,add},{atom,module_info},1}.
{label,8}.
{move,{x,0},{x,1}}.
{move,{atom,add},{x,0}}.
{line,[]}.
{call_ext_only,2,{extfunc,erlang,get_module_info,2}}.
-module(add).
-export([add/2]).
add(A, B) ->
id(A) + id(B).
id(I) ->
I.
Origins of Elixir programming language
Origins of Elixir programming language
158
instructions
Origins of Elixir programming language
Write your own
language that
compiles to
BEAM!
So:
what languages
run on BEAM?
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
But before
Elixir…
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
Jose Valim
Origins of Elixir programming language
Origins of Elixir programming language
Who created
Elixir?
Origins of Elixir programming language
Origins of Elixir programming language
How old
is Elixir?
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
Who supports
Elixir today?
Origins of Elixir programming language
What is
Elixir?
Functional
Concurrent
General-purpose
programming
language
Supports:

metaprogramming
via macros

polymorphism via
protocols
How many
packages
are there?
Origins of Elixir programming language
How many
popular projects
are there, per
GitHub?
Origins of Elixir programming language
What are some of
the most popular
libs?
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
Who uses Elixir
in production?
Origins of Elixir programming language
Origins of Elixir programming language
Origins of Elixir programming language
What
Joe Armstrong
thinks of Elixir?
Origins of Elixir programming language
> Elixir has a non-scary
syntax and combines the
good features of Ruby and
Erlang.
> It's not Erlang and it's not
Ruby and it has ideas of its
own.
What
Elixir offers?
defmodule MathTest do
use ExUnit.Case, async: true
test "can add two numbers" do
assert 1 + 1 == 2
end
end
import Supervisor.Spec
children = [
supervisor(TCP.Pool, []),
worker(TCP.Acceptor, [4040])
]
Supervisor.start_link(children,
strategy: :one_for_one)
parent = self()
# Spawns an Elixir process (not an OS process!)
spawn_link(fn ->
send parent, {:msg, "hello world"}
end)
# Block until the message is received
receive do
{:msg, contents} -> IO.puts contents
end
Origins of Elixir programming language

More Related Content

PDF
7 Stages of Unit Testing in iOS
PDF
Introduction to Elixir
PPTX
PDF
PDF
Introducing Elixir and OTP at the Erlang BASH
PDF
Elixir for rubysts
PDF
Elegant Solutions For Everyday Python Problems - Nina Zakharenko
PDF
Node Boot Camp
7 Stages of Unit Testing in iOS
Introduction to Elixir
Introducing Elixir and OTP at the Erlang BASH
Elixir for rubysts
Elegant Solutions For Everyday Python Problems - Nina Zakharenko
Node Boot Camp

What's hot (20)

PDF
Bootstrap |> Elixir - Easy fun for busy developers
PDF
The Magic Of Elixir
PDF
Memory Management In Python The Basics
PDF
Java Full Throttle
PDF
The Joy Of Ruby
PDF
Ida python intro
PDF
Découvrir dtrace en ligne de commande.
PDF
Elegant Solutions For Everyday Python Problems - PyCon Canada 2017
PDF
A deep dive into PEP-3156 and the new asyncio module
PDF
Elegant Solutions for Everyday Python Problems Pycon 2018 - Nina Zakharenko
PDF
Zope component architechture
PDF
Why Every Tester Should Learn Ruby
PPTX
C to perl binding
KEY
The Why and How of Scala at Twitter
PDF
Exploring Clojurescript
PDF
ssh.isdn.test
PDF
JavaScript - new features in ECMAScript 6
PDF
Seeking Clojure
PDF
Design Patterns - Compiler Case Study - Hands-on Examples
PDF
Zend Certification Preparation Tutorial
Bootstrap |> Elixir - Easy fun for busy developers
The Magic Of Elixir
Memory Management In Python The Basics
Java Full Throttle
The Joy Of Ruby
Ida python intro
Découvrir dtrace en ligne de commande.
Elegant Solutions For Everyday Python Problems - PyCon Canada 2017
A deep dive into PEP-3156 and the new asyncio module
Elegant Solutions for Everyday Python Problems Pycon 2018 - Nina Zakharenko
Zope component architechture
Why Every Tester Should Learn Ruby
C to perl binding
The Why and How of Scala at Twitter
Exploring Clojurescript
ssh.isdn.test
JavaScript - new features in ECMAScript 6
Seeking Clojure
Design Patterns - Compiler Case Study - Hands-on Examples
Zend Certification Preparation Tutorial
Ad

Viewers also liked (20)

PDF
Multi language FBP with Flowex by Anton Mishchuk
PDF
Maksym Pugach - Elixir Release and Deploy Utilities
PDF
Yaroslav Martsynyuk - Deploying Elixir/Phoenix with Distillery
PDF
Alex Troush - IEx Cheat Sheet
PDF
Erlang, LFE, Joxa and Elixir: Established and Emerging Languages in the Erlan...
PDF
Functional Immutable CSS
PDF
Espec |> Elixir BDD
PDF
UDD: building polyglot anti-framework by Marek Piasecki
PDF
Overcommit for #pivorak
PDF
"5 skills to master" by Alexander Skakunov
PDF
"Ruby meets Event Sourcing" by Anton Paisov
PDF
Pivorak Clojure by Dmytro Bignyak
PPTX
Building component based rails applications. part 1.
PPT
Digital Nomading on Rails
PPTX
Building Component Based Rails Applications. Part 2.
PPTX
Права інтелектуальної власності в IT сфері.
PDF
The Silver Bullet Syndrome by Alexey Vasiliev
PDF
GIS on Rails
PDF
Trailblazer Introduction by Nick Sutterer
PDF
Lightweight APIs in mRuby
Multi language FBP with Flowex by Anton Mishchuk
Maksym Pugach - Elixir Release and Deploy Utilities
Yaroslav Martsynyuk - Deploying Elixir/Phoenix with Distillery
Alex Troush - IEx Cheat Sheet
Erlang, LFE, Joxa and Elixir: Established and Emerging Languages in the Erlan...
Functional Immutable CSS
Espec |> Elixir BDD
UDD: building polyglot anti-framework by Marek Piasecki
Overcommit for #pivorak
"5 skills to master" by Alexander Skakunov
"Ruby meets Event Sourcing" by Anton Paisov
Pivorak Clojure by Dmytro Bignyak
Building component based rails applications. part 1.
Digital Nomading on Rails
Building Component Based Rails Applications. Part 2.
Права інтелектуальної власності в IT сфері.
The Silver Bullet Syndrome by Alexey Vasiliev
GIS on Rails
Trailblazer Introduction by Nick Sutterer
Lightweight APIs in mRuby
Ad

Similar to Origins of Elixir programming language (20)

PDF
Elixir
PDF
Introduction to Erlang/(Elixir) at a Webilea Hands-On Session
PDF
Java Bytecode for Discriminating Developers - JavaZone 2011
PDF
Elixir cheatsheet
PDF
Coding in GO - GDG SL - NSBM
PDF
Hello elixir (and otp)
PDF
What can be done with Java, but should better be done with Erlang (@pavlobaron)
PDF
Python GTK (Hacking Camp)
PDF
Being functional in PHP
PDF
Introduction To Erlang Final
PDF
Dallas Scala Meetup
PPTX
Ontopia tutorial
PPTX
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
PDF
The Ring programming language version 1.5.1 book - Part 10 of 180
KEY
An introduction to Ruby
PDF
掀起 Swift 的面紗
PPT
PDF
EKON 25 Python4Delphi_mX4
PDF
Php 7 evolution
PDF
Ruby seen from a C# developer
Elixir
Introduction to Erlang/(Elixir) at a Webilea Hands-On Session
Java Bytecode for Discriminating Developers - JavaZone 2011
Elixir cheatsheet
Coding in GO - GDG SL - NSBM
Hello elixir (and otp)
What can be done with Java, but should better be done with Erlang (@pavlobaron)
Python GTK (Hacking Camp)
Being functional in PHP
Introduction To Erlang Final
Dallas Scala Meetup
Ontopia tutorial
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
The Ring programming language version 1.5.1 book - Part 10 of 180
An introduction to Ruby
掀起 Swift 的面紗
EKON 25 Python4Delphi_mX4
Php 7 evolution
Ruby seen from a C# developer

More from Pivorak MeetUp (20)

PDF
Lisp(Lots of Irritating Superfluous Parentheses)
PDF
Some strange stories about mocks.
PDF
Business-friendly library for inter-service communication
PDF
How i was a team leader once
PDF
Rails MVC by Sergiy Koshovyi
PDF
Introduction to Rails by Evgeniy Hinyuk
PPTX
Ruby OOP (in Ukrainian)
PDF
Testing in Ruby
PDF
Ruby Summer Course by #pivorak & OnApp - OOP Basics in Ruby
PDF
The Saga Pattern: 2 years later by Robert Pankowecki
PDF
Data and Bounded Contexts by Volodymyr Byno
PDF
Successful Remote Development by Alex Rozumii
PDF
Detective story of one clever user - Lightning Talk By Sergiy Kukunin
PDF
CryptoParty: Introduction by Olexii Markovets
PDF
How to make first million by 30 (or not, but tryin') - by Marek Piasecki
PDF
GIS on Rails by Oleksandr Kychun
PDF
Unikernels - Keep It Simple to the Bare Metal
PDF
HTML Canvas tips & tricks - Lightning Talk by Roman Rodych
PDF
Linux Tracing Superpowers by Eugene Pirogov
PDF
Pivorak How to write better sentences in English
Lisp(Lots of Irritating Superfluous Parentheses)
Some strange stories about mocks.
Business-friendly library for inter-service communication
How i was a team leader once
Rails MVC by Sergiy Koshovyi
Introduction to Rails by Evgeniy Hinyuk
Ruby OOP (in Ukrainian)
Testing in Ruby
Ruby Summer Course by #pivorak & OnApp - OOP Basics in Ruby
The Saga Pattern: 2 years later by Robert Pankowecki
Data and Bounded Contexts by Volodymyr Byno
Successful Remote Development by Alex Rozumii
Detective story of one clever user - Lightning Talk By Sergiy Kukunin
CryptoParty: Introduction by Olexii Markovets
How to make first million by 30 (or not, but tryin') - by Marek Piasecki
GIS on Rails by Oleksandr Kychun
Unikernels - Keep It Simple to the Bare Metal
HTML Canvas tips & tricks - Lightning Talk by Roman Rodych
Linux Tracing Superpowers by Eugene Pirogov
Pivorak How to write better sentences in English

Recently uploaded (20)

PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Transform Your Business with a Software ERP System
PDF
System and Network Administraation Chapter 3
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
System and Network Administration Chapter 2
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
Digital Strategies for Manufacturing Companies
PPTX
Introduction to Artificial Intelligence
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Upgrade and Innovation Strategies for SAP ERP Customers
Which alternative to Crystal Reports is best for small or large businesses.pdf
Transform Your Business with a Software ERP System
System and Network Administraation Chapter 3
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
System and Network Administration Chapter 2
VVF-Customer-Presentation2025-Ver1.9.pptx
Odoo Companies in India – Driving Business Transformation.pdf
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
How to Migrate SBCGlobal Email to Yahoo Easily
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Wondershare Filmora 15 Crack With Activation Key [2025
Designing Intelligence for the Shop Floor.pdf
Softaken Excel to vCard Converter Software.pdf
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Digital Strategies for Manufacturing Companies
Introduction to Artificial Intelligence
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Navsoft: AI-Powered Business Solutions & Custom Software Development
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus

Origins of Elixir programming language