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
TDC Porto Alegre 2019 - JS Funcional com Ramda
Search
Ana Luiza Portello
November 29, 2019
Programming
0
230
TDC Porto Alegre 2019 - JS Funcional com Ramda
Ana Luiza Portello
November 29, 2019
Tweet
Share
More Decks by Ana Luiza Portello
See All by Ana Luiza Portello
FRONTIN | Elas Programam - Programação Funcional no Front-end
anabastos
0
81
Workshop JSFP - SEMCOMP 2021
anabastos
0
250
Clojure é um Java melhor que Java - Codecon 2021
anabastos
0
140
Clojure 101 - Criciuma Dev
anabastos
0
300
TDC POA - GraphQL
anabastos
1
260
BackEndSP - GraphQL
anabastos
0
220
Git & Github - RLadies
anabastos
1
230
Programaria Summit - Performance FrontEnd
anabastos
1
210
Programaria Summit - Performance Front-end
anabastos
0
160
Other Decks in Programming
See All in Programming
💎 My RubyKaigi Effect in 2025: Top Ruby Companies 🌐
yasulab
PRO
1
130
RubyKaigi Hack Space in Tokyo & 函館最速 "予習" 会 / RubyKaigi Hack Space in Tokyo & The Fastest Briefing of RubyKaigi 2026 in Hakodate
moznion
1
130
MLOps Japan 勉強会 #52 - 特徴量を言語を越えて一貫して管理する, 『特徴量ドリブン』な MLOps の実現への試み
taniiicom
2
570
Perlで痩せる
yuukis
1
660
當開發遇上包裝:AI 如何讓產品從想法變成商品
clonn
0
2.6k
漸進。
ssssota
0
1.2k
Devinで実践する!AIエージェントと協働する開発組織の作り方
masahiro_nishimi
6
2.6k
AIエージェントによるテストフレームワーク Arbigent
takahirom
0
280
クラシルリワードにおける iOSアプリ開発の取り組み
funzin
1
810
TypeScriptのmoduleオプションを改めて整理する
bicstone
4
430
「兵法」から見る質とスピード
ickx
0
200
【TSkaigi 2025】これは型破り?型安全? 真実はいつもひとつ!(じゃないかもしれない)TypeScript クイズ〜〜〜〜!!!!!
kimitashoichi
1
300
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.8k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.3k
Git: the NoSQL Database
bkeepers
PRO
430
65k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
Music & Morning Musume
bryan
47
6.6k
Navigating Team Friction
lara
186
15k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
60k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Measuring & Analyzing Core Web Vitals
bluesmoon
7
460
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.3k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
32
5.8k
A designer walks into a library…
pauljervisheath
205
24k
Transcript
JS FUNCIONAL COM RAMDA
Olar! Meu nome é Ana Bastos Sou engenheira de software
no Nubank e cientista da computação pela PUC-SP. 2 anabastos @naluhh @anapbastos
3
Apresentar uma nova forma de pensar em JS e uma
possível ferramenta utilitária.
Muito tempo atrás… Que na verdade não é tanto tempo
atrás assim...
IndexOf 2009(ES5)
ver se um elementos está dentro de uma lista 2009(ES5)
None
!!~arr.indexOf(x)
Includes 2016(ES7)
loops js
map filter reduce forEach every some find
ABSTRAÇÕES Provêm ferramental com melhor valor algorítmico que pode salvar
linhas de código, tempo e bugs além de deixar as coisas mais legíveis.
HELPERS
ES6 ES7 ES8 ES9 ??????
RAMDA LODASH/FP
Bibliotecas pensadas para tornar mais fácil o javascript funcional
JS vem aos poucos adotando elementos de linguagens funcionais
Partial Application Pipeline operator Pattern Matching Flatmap PROPOSALS
RAMDA É DIFERENTE
DAY 0
Te força implementar conceitos funcionais direito de forma bonita e
bem fundamentada
IMUTABILIDADE
Pequenas funções puras reusáveis com apenas uma responsabilidade
SÓ FUNÇÕES
None
• Lists(map, filter, reduce, contains, replace, passAll, crop, flatten, find)
• Maths(inc, add, mean, sum) • String(split, replace) • Logics(equals, cond, not) • Relations(intersection, clamp, gt, lt) • Functions(curry, pipe, compose, ifElse, etc)
PQ PODE SER UMA BOA IDEIA?
Evita caca(Pureza / Mutabilidade) É mais produtivo(reuso) Ajuda a ler
codigo Ajuda muito a testar Faz muito sentido no front-end
Lida com undefineds / nulls
doSomething(obj.prop)
None
None
O PULO DO GATO
CURRY
None
TODA FUNCAO UNÁRIA
TODAS AS FUNCÕES SÃO CURRIED
None
None
None
Aplica os parametros da esquerda pra direita quando você tem
eles
PROPOSAL PARTIAL APPLICATION https://github.com/tc39/proposal-partial-application
None
A ordem dos argumentos são para facilitar o dado a
ser operado mais na direita
None
Funções <= Dado =>
Cond(Pattern Matching) If () { If () { if() {
if() { } } } Else { If () { } } }
Cond(Pattern Matching)
Cond(Pattern Matching)
PATTERN MATCHING PROPOSAL https://github.com/tc39/proposal-pattern-matching
Como se modela coisas?
PIPES
PIPELINE OPERATOR PROPOSAL https://github.com/tc39/proposal-pipeline-operator
function 1 function 2 INPUT OUTPUT OUTPUT
None
Composed Function INPUT OUTPUT
[5, 5, 4, 6] Média com ponto de participação deve
ser maior ou igual a 5
None
POINT-FREE PROGRAMMING
None
None
PIPE COMPOSE
None
HOF (Recompose)
PIPEP / COMPOSEP
then(a) .then(b) .then(c) .then(d)
await a() await b() await c() await d()
None
BIBLIOTECA DO FUTURO DO JS
HIGHLIGHTS
Perguntei pra amigos meus o que eles usam e as
respostas foram bem diferentes
APLICAÇÃO PARCIAL EM TESTES
EVOLVE APPLYSPEC DIFFERENCE UNIQ PROP
LENSES(Lidar com estado) MEMOIZATION(Lidar com recursão)
None
WARNINGS / APRENDIZADOS
• Cuidado com o RamdaScript • Legibilidade do projeto •
Anti-OpenSource • Isole o RamdaFucks(ramdaUtils)
COOKBOOK
• Rambda - github.com/selfrefactor/rambda • Ramda-fantasy - github.com/ramda/ramda-fantasy • Ramda
React Redux Patterns - tommmyy.github.io/ramda-react-redux-patterns/ • Thinking Ramda - randycoulman.com/blog/2016/05/24/thinking-in-ramda-gett ing-started • Ramda - Derek Stavis(Pagar.me talks) • Hey Underscore, You’re doing it wrong - Brian Lonsdorf.
Obrigada! anabastos @naluhh @anapbastos 81 speakerdeck.com/anabastos