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
Programação Funcional & Elixir
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Amanda
November 04, 2017
Technology
130
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Programação Funcional & Elixir
Amanda
November 04, 2017
More Decks by Amanda
See All by Amanda
Lessons Learned From an Elixir OTP Project
amandasposito
2
98
Aprendizados de um projeto Elixir OTP
amandasposito
4
640
SOLID - Dependency inversion principle
amandasposito
0
92
Como concorrência funciona em Elixir?
amandasposito
1
240
Ecto, você sabe o que é ?
amandasposito
4
250
Novidades no Rails 5
amandasposito
0
100
Rails Engines & RSpec
amandasposito
0
240
Elixir e Phoenix
amandasposito
3
590
Elixir em 5 minutos
amandasposito
1
100
Other Decks in Technology
See All in Technology
AI活用を推進するために ファインディが下した、一つの小さな決断
starfish719
0
250
Databricks 月刊サービスアップデート 2026年05月号
tyosi1212
0
210
ABEMA の Datadog × OTel 基盤、 中から見るか? 外から見るか?
tetsuya28
0
100
Rancherの紹介&Update情報(RancherJP Online Meetup #09)
yoshiyuki_kono
0
120
Claude Code×Terraform IaC テンプレート駆動開発
itouhi
1
380
マーケットプレイス版Oracle WebCenter Content For OCI
oracle4engineer
PRO
5
1.8k
探して_入れて_作って_使う_Agent_Skills___LT.pdf
peintangos
2
160
新規ゲーム開発におけるAI駆動開発のリアル
202409e2
0
2.7k
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
2.8k
価格.comをAI駆動で全面刷新する ー 30年分の技術的負債を返し、次の30年の土台をつくる ー / AI Engineering Summit Tokyo 2026
tkyowa
49
54k
React、まだ楽しくて草
uhyo
7
4.1k
Cloud Run のアップデート 触ってみる&紹介
gre212
0
320
Featured
See All Featured
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
600
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.7k
Building AI with AI
inesmontani
PRO
1
1.1k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
720
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
380
Testing 201, or: Great Expectations
jmmastey
46
8.2k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
200
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.8k
New Earth Scene 8
popppiees
3
2.3k
Transcript
Programação Funcional & Elixir
@amandasposito @amsposito @amandasposito
None
Falando um pouco de história
http://www.gotw.ca/publications/concurrency-ddj.htm
None
None
“Efficiency and performance optimization will get more, not less, important.”
“Applications will increasingly need to be concurrent if they want
to fully exploit continuing exponential CPU throughput gains.”
Por que isso afeta nossa aplicação?
None
Elixir criada por José Valim
Percebeu que as ferramentas que existiam não eram boas para
concorrência
None
Elixir roda em cima da maquina virtual do Erlang
Erlang é conhecido por rodar aplicações com latência baixa, distribuídas
ou tolerante a falhas
Escalabilidade Tolerância a falhas Compatível com Erlang Hot Code Swap
Linguagem Dinâmica Metaprogramação Polimorfismo Concorrência
Diferentes paradigmas
Paradigma Funcional
–Introduction to Functional Programming - Richard Bird Philip Wadler “Programming
in a functional language consists of building definitions and using the computer to evaluate expressions.”
Imutabilidade
Consistência de dados
Concorrência Capacidade de lidar com várias coisas ao mesmo tempo
https://blog.whatsapp.com/196/1-million-is-so-2011?
Vamos resolver um problema
None
None
switch = fn (bulb) -> ... end switch.(bulb)
defmodule LightBulb do def switch(human, bulb) do end end LightBulb.switch(bulb)
Pattern Matching
name = "Amanda"
Interactive Elixir (1.5.2) - press Ctrl+C to exit (type h()
ENTER for help) iex(1)> name = "Amanda" "Amanda" iex(2)> "Amanda" = name "Amanda" iex(3)> "Amanda S" = name ** (MatchError) no match of right hand side value: "Amanda"
defmodule LightBulb do def switch(human = %Human{}, bulb = %Bulb{})
… end end
Function Arity
defmodule LightBulb do def switch(human, bulb) do ... end def
switch(_) do IO.puts "Precisamos de um humano e de uma escada." end end
Guards
defmodule LightBulb do def switch(human, bulb) when bulb.burned_out == true
do … end end
If and unless
defmodule LightBulb do def switch(human, bulb) when bulb.burned_out == true
do ladder = Ladder.get_average_height() if ladder.under do … end end end
Pipe Operator
new_bulb = Bulb.get_bulb() lader = Ladder.get_average_height() human = Human.climb(human, ladder)
human = Human.remove_bulb(human, bulb) human = Human.put_bulb(human, new_bulb)
Ladder.get_average_height() |> Human.climb(human) |> Human.remove_bulb(bulb) |> Human.put_bulb(new_bulb)
None
Recursão
numbers = 3; for(i = numbers; i > 0; i--)
{ console.log(i); }
None
defmodule NaturalNums do # Uma clausula para parar a recursão
def print(1), do: IO.puts(1) def print(n) do # Imprime o número" IO.puts(n) # Chama a si mesmo com um valor a menos print(n - 1) end end
iex(1)> NaturalNums.print(3) 3 2 1 :ok
None
None
https://www.codeschool.com/courses/try-elixir
https://www.dailydrip.com/topics/elixir https://github.com/dailydrip/firestorm
http://plataformatec.com.br/elixir-radar
None
Obrigada!
Referências • https://hipsters.tech/elixir-a-linguagem-hipster- hipsters-48/ • https://codewords.recurse.com/issues/one/an- introduction-to-functional-programming • http://theerlangelist.blogspot.com.br/2013/05/working- with-immutable-data.html