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
Search
Igor Soares
July 07, 2016
180
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Javascript Funcional
Palestra sobre Javascript Funcional
hack.river São José do RIo Preto
Igor Soares
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 Igor Soares
See All by Igor Soares
Por que a programação funcional é importante?
nulligor
0
60
Featured
See All Featured
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
1
320
Embracing the Ebb and Flow
colly
88
5.2k
Building Applications with DynamoDB
mza
96
7.3k
SEO for Brand Visibility & Recognition
aleyda
0
4.9k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
890
Leo the Paperboy
mayatellez
11
2.5k
Mind Mapping
helmedeiros
1
460
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
570
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
360
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
3k
Building Better People: How to give real-time feedback that sticks.
wjessup
371
20k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M