Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Javascript Funcional - Uma breve introdução @Ig...
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
hack.river
July 07, 2016
Programming
48
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Javascript Funcional - Uma breve introdução @Igor Soares
hack.river
July 07, 2016
Transcript
43 slides
Javascript Funcional uma breve Introdução
github.com/ripfoghorn twitter.com/ripfoghorn_ 20 anos desenvolvedor back-end por 3 anos entusiasta
de robôs gigantes
Programação Funcional?
Paradigma de programação que trata a computação como uma avaliação
de funções matemáticas e que evita estados ou dados mutáveis.
?
Paradigma
Funções puras Imutabilidade de estado Composição de funções Redução de
código
Matemática
f(x) = 2x + 1
f(3) = 2(3) + 1 = 7
g(y) = y + 5
f(g(y)) = f(y + 5) = 2(y + 5) +
1 = 2y + 11
Programação Funcional == Matemática
Funções
function f(x) { return 2*x + 1; }
function g(y) { return y + 5; }
console.log(f(g(3)));
17
Funções de ordem superior e funções de primeira classe
var composta = function(a) { return f(g(a)); }
composta(3) //=> 17 composta(4) //=> 19
Composição
var add1= function(x){ return x + 1; }
var quadrado = function(x){ return x * x; }
var f = function(x) { return add1(quadrado(x)); }
console.log(f(7)) ??
50
Funções Puras Imutabilidade de estado
function pura(a, b) { return a + b; }
var a = 1; function impura(b) { return a +
b; }
a = new Date().getDay();
Estado
f(x) = 2x f(2) = 4
Arrays!
Curry!
OK, mas por que Javascript mesmo?
Node NPM Full-stack
ES6 Arrow Functions Map Reduce Filter ...
IIFE’s
(function() {...})(); (()=> {...})();
Underscore Lodash Ramda Immutable Fn Function
Fun();
Obrigado!
More Decks by hack.river
See All by hack.river
hack.river #intro
hackriver
0
730
ElasticSearch - Tornando suas buscas textuais mais poderosas @Thiago Gonzaga
hackriver
0
48
Other Decks in Programming
See All in Programming
将来の標準フォーマッター?ktfmtを深堀る
t45k
0
250
数行の変更でDockerビルドを最大91%高速化~GitLab CIの実行基盤を社内40リポジトリに展開するまで~
picopico
3
640
仕様駆動開発入門 (何を作るかを先に決めて渡す) | 目指せ Kiro マスター 05
inariku
PRO
3
220
そのデザイントークン、Flutterでも同じ見た目になりますか?
nakamizu
0
480
Debian JP Projectのサーバー構成
uwabami
1
180
SODA - FACT BOOK(EN)
sodainc
1
290
テストだけで見つかる? Rubyでつくるメソッド発掘器
izawa
0
160
眠らない開発チームの作り方
biwakonbu
0
120
Going Full Circle with Virtual Graphs and Relational Databases
michaelsimons
1
110
[Kotlin Fest 2026] eBPF Tracing for Kotlin
takehaya
1
410
Skills Are the New npm [AAIF Bengaluru, Nov 2026]
shivamsaraswat
0
130
読みやすい!と評判(?)の発表の準備にかける私のこだわり
shoheimitani
0
170
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
37
7.5k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
3k
Testing 201, or: Great Expectations
jmmastey
46
8.4k
Mind Mapping
helmedeiros
1
460
Documentation Writing (for coders)
carmenintech
77
5.7k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
850
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
760
Bash Introduction
62gerente
615
220k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
340
Making the Leap to Tech Lead
cromwellryan
135
10k
We Are The Robots
honzajavorek
0
460