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
Building a game with Elixir and Elm
Search
Paulo Diniz
September 08, 2017
Programming
0
69
Building a game with Elixir and Elm
Building a game with Elixir and Elm
Paulo Diniz
September 08, 2017
Tweet
Share
More Decks by Paulo Diniz
See All by Paulo Diniz
Functional Programming in FrontEnd
paulodiniz
0
130
Vim + tmux for Brazilian Training Center
paulodiniz
1
51
Other Decks in Programming
See All in Programming
速いWebフレームワークを作る
yusukebe
5
1.7k
More Approvers for Greater OSS and Japan Community
tkikuc
1
110
CloudflareのChat Agent Starter Kitで簡単!AIチャットボット構築
syumai
2
430
Oracle Database Technology Night 92 Database Connection control FAN-AC
oracle4engineer
PRO
1
410
実用的なGOCACHEPROG実装をするために / golang.tokyo #40
mazrean
1
230
モバイルアプリからWebへの横展開を加速した話_Claude_Code_実践術.pdf
kazuyasakamoto
0
310
アセットのコンパイルについて
ojun9
0
110
Ruby×iOSアプリ開発 ~共に歩んだエコシステムの物語~
temoki
0
250
Azure SRE Agentで運用は楽になるのか?
kkamegawa
0
1.5k
DockerからECSへ 〜 AWSの海に出る前に知っておきたいこと 〜
ota1022
5
1.9k
ソフトウェアテスト徹底指南書の紹介
goyoki
1
140
Improving my own Ruby thereafter
sisshiki1969
1
160
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
55
13k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.6k
Balancing Empowerment & Direction
lara
3
610
Code Review Best Practice
trishagee
70
19k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
51
5.6k
Intergalactic Javascript Robots from Outer Space
tanoku
272
27k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.9k
Docker and Python
trallard
45
3.5k
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.5k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
Transcript
Hi ! I'm Paulo
Born
Live
Work
Like
Like
Like
Like
Functional Programming Fits my mental map Many languages have it
It feels right for me
Elixir Enum.map(["1", "2", "3"], &(String.to_integer &1)) => [1, 2, 3]
Ruby ['1', '2', '3'].map(&:to_i) => [1, 2, 3]
Javascript ['1', '2', '3'].map(parseInt) => [ 1, NaN, NaN ]
Couldn't apply my mental models directly ! Note: Javascript community
❤ Note2: Underscore.js ❤ Note3: Ramda ❤ Note4: React ❤
Maybe I should try to use another language? Elm Clojurescript
PureScript ElixirScript
I used Elm to make a game
None
Elixir on server Phoenix websockets OTP Also matched my mental
model
updateFlappy : Game -> ( Game, Cmd Msg ) updateFlappy
game = game |> gravity |> physics |> upperLimit |> checkPipeColision |> updatePipes |> updateScore
updateScore : Game -> ( Game, Cmd Msg ) updateScore
game = let score = game.pipes |> List.filter (\pipe -> pipe.passed == True) |> List.length |> (\x -> x // 2) in if (game.score == score) then ( game, Cmd.none ) else { game | score = score } |> update SendScore
Server top_players = players |> Enum.sort(fn(p1, p2) -> p1.score >
p2.score end) |> Enum.take(3)
Wrapping up I'm not confortable with JS If you're also
not, try other languages Make games, they're awesome https://paulodiniz.github.io/flappy-bird/
Thank you twitter: @paulodiniz github: paulodiniz