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
Reduzco, reuso y reciclo
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Lupo Montero
February 21, 2019
Programming
0
37
Reduzco, reuso y reciclo
LimaJS - 21/02/2019
Lupo Montero
February 21, 2019
Tweet
Share
More Decks by Lupo Montero
See All by Lupo Montero
Trigonometría Bella
lupomontero
0
36
Analizadores sintácticos funcionales en JavaScript
lupomontero
0
94
Manejo de memoria en Rust: Ownership
lupomontero
0
40
Hola Rust! Aprendiendo con rustlings
lupomontero
1
320
WebThing: construyamos una lámpara 💡
lupomontero
1
77
Combinando y grabando ⏺ video 🎥 y audio 🎙 en el navegador
lupomontero
0
30
Web Assembly, Rust y el futuro de JavaScript
lupomontero
0
51
Primeros pasos con Rust y WebAssembly
lupomontero
0
520
Paralelizando promesas
lupomontero
0
350
Other Decks in Programming
See All in Programming
PostgreSQL を使った快適な go test 環境を求めて
otakakot
0
550
Swift ConcurrencyでよりSwiftyに
yuukiw00w
0
270
grapheme_strrev関数が採択されました(あと雑感)
youkidearitai
PRO
1
220
Agentic AI: Evolution oder Revolution
mobilelarson
PRO
0
180
「やめとこ」がなくなった — 1月にZennを始めて22本書いた AI共創開発のリアル
atani14
0
390
Agent Skills Workshop - AIへの頼み方を仕組み化する
gotalab555
15
8.8k
Claude Code Skill入門
mayahoney
0
390
Claude Codeセッション現状確認 2026福岡 / fukuoka-aicoding-00-beacon
monochromegane
4
420
「抽象に依存せよ」が分からなかった新卒1年目の私が Goのインターフェースと和解するまで
kurogenki
0
120
CSC307 Lecture 14
javiergs
PRO
0
470
AI時代のソフトウェア開発でも「人が仕様を書く」から始めよう-医療IT現場での実践とこれから
koukimiura
0
150
go directiveを最新にしすぎないで欲しい話──あるいは、Go 1.26からgo mod initで作られるgo directiveの値が変わる話 / Go 1.26 リリースパーティ
arthur1
2
550
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
Embracing the Ebb and Flow
colly
88
5k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
Mobile First: as difficult as doing things right
swwweet
225
10k
Docker and Python
trallard
47
3.8k
Claude Code のすすめ
schroneko
67
220k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
150
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.1k
The SEO Collaboration Effect
kristinabergwall1
0
390
How to Think Like a Performance Engineer
csswizardry
28
2.5k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Transcript
@lupomontero LimaJS - 21/02/2019
@Laboratoriala @LimaJSorg @NodeSchool @lupomontero @mozillaperu
Qué es reduce? Blah blah blah… • Transformar un arreglo
en un “valor” • Transformar un arreglo en otro “tipo” • Responder preguntas sobre la colección (por ejemplo estadísticas) • Resumir una colección • ...
[any] Array.prototype.reduce(fn, initialValue) The reduce() method executes a reducer function
(that you provide) on each member of the array resulting in a single output value. Fuente: MDN
.reduce .filter .map .forEach
None
[1,2,3,4,5].reduce((prev, item) => prev + item, 0)
Un ejemplo de reduce
Implementación imperativa • Bucle / iteración • Mutación / reasignación
Reglas del juego... • No sentencias / sólo expresiones •
No mutación / no re-asignación • ...
… antes de empezar con la implementación ... • Operador
ternario • Operador de propagación (spread operator) • !! (bang bang! doble negación)
Implementación declarativa • Recursión • Inmutabilidad • Expresiones
Ejemplos de aplicaciones de reduce • map • filter •
join • forEach • ...
map
filter
join
forEach
includes
indexOf
lastIndexOf
reverse
reduceRight
Fin (Gracias!)