Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Intro to Elixir
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Mario Alberto Chávez
November 05, 2015
Programming
0
170
Intro to Elixir
Presentation about Elixir programming language
Mario Alberto Chávez
November 05, 2015
Tweet
Share
More Decks by Mario Alberto Chávez
See All by Mario Alberto Chávez
Ruby Internals V3
mario_chavez
0
59
Beyond the Rails Way
mario_chavez
1
100
Elm, una mejor manera de hacer frontend
mario_chavez
0
240
Rediscovering ActiveRecord
mario_chavez
2
340
From Ruby to Elixir: Developing Web Applications
mario_chavez
0
420
Pitch para Startups
mario_chavez
1
140
Understanding KPIs
mario_chavez
1
110
Logic Programming
mario_chavez
0
120
El nuevo comercio electrónico
mario_chavez
0
79
Other Decks in Programming
See All in Programming
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
550
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
260
0→1 フロントエンド開発 Tips🚀 #レバテックMeetup
bengo4com
0
560
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
210
IFSによる形状設計/デモシーンの魅力 @ 慶應大学SFC
gam0022
1
300
Oxlintはいいぞ
yug1224
5
1.3k
Automatic Grammar Agreementと Markdown Extended Attributes について
kishikawakatsumi
0
180
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
1k
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
1.1k
OSSとなったswift-buildで Xcodeのビルドを差し替えられるため 自分でXcodeを直せる時代になっている ダイアモンド問題編
yimajo
3
610
CSC307 Lecture 02
javiergs
PRO
1
780
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
4
460
Featured
See All Featured
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
250
Everyday Curiosity
cassininazir
0
130
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
240
Mobile First: as difficult as doing things right
swwweet
225
10k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
200
From π to Pie charts
rasagy
0
120
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
730
Rails Girls Zürich Keynote
gr2m
96
14k
Ruling the World: When Life Gets Gamed
codingconduct
0
140
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.9k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.1k
Transcript
Intro to Elixir Mario Alberto Chávez @mario_chavez
Compiles to BEAM byte code Runs on Erlang VM
Concurrency
Concurrency Lightweight processes |>Are applications |>Requires a minimum of 2k
of memory |>Are supervised |>Fault-tolerant |>Garbage collected independent |>Run on multicore machines
Concurrency Actor pattern |>Receive messages |>Process data |>Talk to other
processes |>Start new processes |>Respond to messages
Concurrency Distributed
OTP is simple to design complex systems
Functional
Functional Unlearn OO |>Inmutable data |>No objects |>No classes |>No
Inheritance
Functional Functions transform data |>Small and focused |>Composable |>Repeatable |>Don’t
have side effects |>Data is passed by Value
Simple, clean, fun syntax
Atoms :ok, :accepted
Tuples { :ok, 1, “data” }
Lists [1, “data”, :ok, {“a”}]
Maps data = %{ name: “Mario”, language: “Elixir” } data.name
=> “Mario” data[:language] => “Elixir
Keywords List data = [name: “Mario”, language: “Elixir”] data[:name]
=> “Mario” data.name ** (ArgumentError) argument error
Ranges (1..5)
Functions adder = fn(a) -> fn(b) -> a + b
end end add2 = adder.(2) add.(3) => 5
Inline functions Enum.map([1, 2], fn(value) -> value * value end)
=> [1, 4] Enum.map([1, 2], &(&1 * &1)) => [1, 4]
Named functions defmodule Math do def add2(value) do value +
2 end end Math.add2(5) => 7
Pattern matching
Match operator = a = 1 => 1 1 =
a => 1 2 = a ** (MatchError) no match of right hand side value: 1 ^a = 2 ** (MatchError) no match of right hand side value: 2
Deconstruction list = [1, 3, 5, 7] [1, a |
tail] = list a => 3 tail => [5, 7]
Deconstruction data = %{ name: “Mario”, language: “Elixir” } %{
name: name } = data name => “Mario”
Multiple clauses require Integer, only: [is_odd/1] defmodule Math do def
mult(0), do: 0 def mult(x) when Integer.is_odd(x), do: x * 3 def mult(x), do: x * -3 end Math.mult(0) => 0 Math.mult(3) => 9 Math.mult(6) => -18
Functions composition
Pipeline [7, nil, 3, nil, 5, 1] |> Enum.filter(&(&1))
|> Enum.sort |> Enum.map(&(&1 * 2)) |> Enum.join(", ") => ”2, 6, 10, 14"
Many more
Metaprogramming Language extensibility |>Metaprogramming is core to Elixir |>Add new
functionality |>Create DSLs
mix Compilation and tasks tools |>Compiles code |>Execute tasks |>Creates
project template
hex package manager |>Resolves dependencies |>Install libraries
docs beautiful and complete help
Web development Phoenix Framework
Learn more Resources |>Elixir playground http://elixirplayground.com |>Slack channel for help
|>Programming Elixir Book
Intro to Elixir Mario Alberto Chávez @mario_chavez