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
what is this elixir thing everyone is talking about
Search
José Tomás Albornoz
September 16, 2016
Programming
0
120
what is this elixir thing everyone is talking about
some of my fav features of elixir
lightning talk for CodeDaze.io on September 16th, 2016
José Tomás Albornoz
September 16, 2016
Tweet
Share
More Decks by José Tomás Albornoz
See All by José Tomás Albornoz
Things I learned when working on a small startup
eljojo
0
80
Introduction to Dokku
eljojo
1
140
Baruco 2014: How I Built My Own Twitch-Plays-Pokémon
eljojo
0
770
Introduction to Docker
eljojo
0
210
Other Decks in Programming
See All in Programming
Findy - エンジニア向け会社紹介 / Findy Letter for Engineers
findyinc
2
76k
RuboCop: LSP and Prism
koic
3
1.6k
来週から実践できる! LayerXのバクラク事業部で行われている Go 関連の読書会のご紹介 / Bakuraku Go Reading Group
upamune
5
250
Datadogのmonitorを Terraform管理に爆速で 移行する
kuro_kurorrr
2
280
見えないものに着目すると上手くいく、モデリングの勘所 / invisible-driven-design
minodriven
18
3.7k
Community-driven RBS repository
pocke
2
390
Improved REXML XML parsing performance using StringScanner
naitoh
0
190
Good first issues of TypeProf
mame
4
2.9k
Hi, have you met Kotlin Multiplatform? | Kotlin User Group Berlin
prof18
1
130
LTのやり方
yosuke_furukawa
PRO
8
1.1k
Prepare for Jakarta EE 11 - Performance and Developer Productivity
ivargrimstad
0
770
ウォンテッドリーでのKMPワークフロー / KMP workflow at Wantedly
kubode
0
120
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
4
190
ParisWeb 2013: Learning to Love: Crash Course in Emotional UX Design
dotmariusz
104
6.7k
Building Applications with DynamoDB
mza
88
5.7k
Statistics for Hackers
jakevdp
790
220k
What the flash - Photography Introduction
edds
64
11k
What's in a price? How to price your products and services
michaelherold
238
11k
Robots, Beer and Maslow
schacon
PRO
155
8k
The World Runs on Bad Software
bkeepers
PRO
61
6.8k
Mobile First: as difficult as doing things right
swwweet
217
8.6k
How GitHub (no longer) Works
holman
305
140k
Designing on Purpose - Digital PM Summit 2013
jponch
111
6.5k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
9
3.6k
Transcript
what is this elixir thing everyone's talking about by jojo
what is elixir
elixir is a functional language
created by José Valim
that runs on the erlang vm
pattern matching iex(1)> [first, second] = [1, 2] [1, 2]
iex(2)> first 1
pattern matching iex(2)> [first, second] = [1,2,3] ** (MatchError) no
match of right hand side value: [1, 2, 3]
pattern matching iex(1)> payload = %{username: "eljojo", stuff: true} %{stuff:
true, username: "eljojo"} iex(2)> %{username: name} = payload %{stuff: true, username: "eljojo"} iex(3)> name "eljojo"
function overloading def make_sound(:cow) do IO.puts "MOOOOOOOOO" end def make_sound(:cat)
do IO.puts "MEEEOOWW" end def make_sound(_) do IO.puts "¯\_(ϑ)_/¯" end
function overloading def make_sound(%{animal: :cow}) do IO.puts "MOOOOOOOOO" end def
make_sound(%{animal: :cat}) do IO.puts "MEEEOOWW" end def make_sound(%{animal: name}) do IO.puts "not sure how to #{name} ¯\_(ϑ)_/¯" end
we also got guards def page_ops(downtime) when downtime < 10
do IO.puts "¯\_(ϑ)_/¯" end def page_ops(downtime) when downtime >= 10 do PagerDuty.notify(whatever) end
pipe operator def add_one(number), do: number + 1 def multiply_by_three(number),
do: number * 3 multiply_by_three(add_one(1)) # => 6
pipe operator def add_one(number), do: number + 1 def multiply_by_three(number),
do: number * 3 1 |> add_one |> multiply_by_three # => 6
processes + messages current_process = self() spawn_link(fn -> send(current_process, {:msg,
"hello world"}) end) receive do {:msg, contents} -> IO.puts contents end
processes + messages # machine one receive do {:msg, contents}
-> IO.puts contents end # machine two process_name = "$MACHINE_ONE" spawn_link(fn -> send(process_name, {:msg, "yo!"}) end)
what is phoenix
A productive web framework that does not compromise speed and
maintainability.
it's basically rails for elixir, but cooler
validations def changeset(struct, params \\ %{}) do struct |> cast(params,
[:email_address, :first_name]) |> validate_required([:email_address]) end def changeset_after_signup(struct, params \\ %{}) do changeset(struct, params) |> validate_required([:first_name]) end
we're hiring!
@eljojo