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
Javascript Funcional - Uma breve introdução @Ig...
Search
hack.river
July 07, 2016
Programming
0
42
Javascript Funcional - Uma breve introdução @Igor Soares
hack.river
July 07, 2016
Tweet
Share
More Decks by hack.river
See All by hack.river
hack.river #intro
hackriver
0
720
ElasticSearch - Tornando suas buscas textuais mais poderosas @Thiago Gonzaga
hackriver
0
40
Other Decks in Programming
See All in Programming
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
650
humanlayerのブログから学ぶ、良いCLAUDE.mdの書き方
tsukamoto1783
0
190
AIによる高速開発をどう制御するか? ガードレール設置で開発速度と品質を両立させたチームの事例
tonkotsuboy_com
7
2.3k
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
280
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
200
CSC307 Lecture 01
javiergs
PRO
0
690
AI & Enginnering
codelynx
0
110
SourceGeneratorのススメ
htkym
0
200
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
1k
Architectural Extensions
denyspoltorak
0
290
0→1 フロントエンド開発 Tips🚀 #レバテックMeetup
bengo4com
0
560
AgentCoreとHuman in the Loop
har1101
5
230
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.8k
What's in a price? How to price your products and services
michaelherold
247
13k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.1k
Designing Powerful Visuals for Engaging Learning
tmiket
0
230
Technical Leadership for Architectural Decision Making
baasie
1
240
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
300
Site-Speed That Sticks
csswizardry
13
1.1k
Believing is Seeing
oripsolob
1
55
The SEO Collaboration Effect
kristinabergwall1
0
350
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
200
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
62
Automating Front-end Workflow
addyosmani
1371
200k
Transcript
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!