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 a...
Search
José Tomás Albornoz
September 16, 2016
Programming
0
130
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
86
Introduction to Dokku
eljojo
1
140
Baruco 2014: How I Built My Own Twitch-Plays-Pokémon
eljojo
0
830
Introduction to Docker
eljojo
0
230
Other Decks in Programming
See All in Programming
クラウドサービスの 利用コストを削減する技術 - 円安の真南風を感じて -
pyama86
3
240
tsconfig.jsonの最近の新機能 ファイルパス編
uhyo
6
1.4k
個人開発で使ってるやつを紹介する回
yohfee
1
670
Infrastructure as Code でセキュリティを楽にしよう!
konokenj
6
1.4k
4年間変わらなかった YOUTRUSTのアーキテクチャ
daiki1003
0
100
学生の時に開催したPerl入学式をきっかけにエンジニアが組織に馴染むために勉強会を主催や仲間と参加して職能間の境界を越えていく
ohmori_yusuke
1
120
CSC509 Lecture 02
javiergs
PRO
0
160
Assembling the Future: crafting the missing pieces of the Ruby on Wasm puzzle
skryukov
0
130
.NET Aspireのクラウド対応検証: Azureと他環境での実践
ymd65536
1
290
CSC509 Lecture 03
javiergs
PRO
0
140
フロントエンドの現在地とこれから
koba04
10
4.3k
Kubernetes上でOracle_Databaseの運用を楽にするOraOperatorの紹介
nnaka2992
0
150
Featured
See All Featured
What's new in Ruby 2.0
geeforr
341
31k
Mobile First: as difficult as doing things right
swwweet
222
8.8k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
1
250
For a Future-Friendly Web
brad_frost
174
9.3k
Infographics Made Easy
chrislema
239
18k
Building Applications with DynamoDB
mza
90
6k
Done Done
chrislema
181
16k
The Mythical Team-Month
searls
218
43k
The Invisible Side of Design
smashingmag
297
50k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
2
220
A Tale of Four Properties
chriscoyier
155
22k
The Cost Of JavaScript in 2023
addyosmani
43
5.8k
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