Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up
for free
Elixir Mini Introduction for Zürich Meetup
Stefan Wintermeyer
February 20, 2017
Technology
0
78
Elixir Mini Introduction for Zürich Meetup
Stefan Wintermeyer
February 20, 2017
Tweet
Share
More Decks by Stefan Wintermeyer
See All by Stefan Wintermeyer
wintermeyer
0
34
wintermeyer
0
780
wintermeyer
3
150
wintermeyer
0
55
wintermeyer
5
540
wintermeyer
0
220
wintermeyer
1
170
wintermeyer
1
120
wintermeyer
1
280
Other Decks in Technology
See All in Technology
nkjzm
1
850
yosuke_furukawa
PRO
47
16k
chaspy
1
160
ocise
1
970
sumi
0
540
helayoty
0
140
tdys13
5
3.5k
toshinoritakai
1
210
hamadakoji
1
1.1k
kawaguti
0
120
satoshirobatofujimoto
0
110
kyonmm
1
2.3k
Featured
See All Featured
samanthasiow
56
6.3k
jakevdp
775
200k
destraynor
146
19k
pedronauck
652
110k
scottboms
251
11k
lauravandoore
437
28k
jonyablonski
14
1.1k
holman
288
130k
paulrobertlloyd
71
3.6k
jonrohan
1021
380k
marktimemedia
6
340
jrom
114
7.1k
Transcript
Elixir Stefan Wintermeyer @wintermeyer
Elixir is a functional, concurrent, general-purpose programming language that runs
on the Erlang virtual machine (BEAM). https://en.wikipedia.org/wiki/Elixir_(programming_language)
defmodule ModuleName do def hello do IO.puts "Hello World" end
end http://elixir-lang.org/crash-course.html
IEx Elixir’s interactive shell
None
Why would I want to learn Elixir? Why invest the
time and effort? I’m happy with Ruby and OO.
Three Main Reasons Spoiler Alert: Concurrency is not one of
them.
1. Speed Elixir runs circles around Ruby and Python.
2. Stability Speed is nothing without stability.
3. Hot-Code Upgrades Zero Downtime!
Some Code Examples
Assigning Values to Variables
iex(1)> a = 1 1 iex(2)>
iex(1)> a = 1 1 iex(2)> a = 2 2
iex(3)>
iex(1)> a = 1 1 iex(2)> a = 2 2
iex(3)> ^a = 3 ** (MatchError) no match of right hand side value: 3
Tuples
iex(1)> {a, b, c} = {10, 20, 30} {10, 20,
30} iex(2)>
iex(1)> {a, b, c} = {10, 20, 30} {10, 20,
30} iex(2)> a 10 iex(3)>
Pattern Matching
iex(1)> {a, b, c} = {10, 20, 30} {10, 20,
30} iex(2)>
iex(1)> {a, b, c} = {10, 20, 30} {10, 20,
30} iex(2)> {a, 20, c} = {10, 20, 30} {10, 20, 30} iex(3)>
iex(1)> {a, b, c} = {10, 20, 30} {10, 20,
30} iex(2)> {a, 20, c} = {10, 20, 30} {10, 20, 30} iex(3)> {a, 1, c} = {10, 20, 30} ** (MatchError) no match of right hand side value: {10, 20, 30}
If you want to get your feed wet with Elixir
I recommend two projects.
If you like hardware try http://nerves-project.org
None
If you like the web try www.phoenixframework.org
None
Phoenix Framework Productive. Reliable. Fast. Phoenix != Rails
None
mix phoenix.new blog Y cd blog vim config/dev.exs brew install
postgres brew services start postgres createuser -W --createdb blog demo mix ecto.create mix phoenix.gen.html Post posts subject body vim web/router.ex resources "/posts", PostController mix ecto.migrate mix phoenix.server Blog Example
Thank you! @wintermeyer