Slide 7
Slide 7 text
How important is chaining?
// Chaining
const arr = new Set([0, -1, 3])
.values()
.filter(x => x >= 0)
.map(x => x * 2)
.toArray();
// Naming the steps
const set = new Set([0, -1, 3]);
const filtered = filter(x => x>=0, set);
const mapped = map(x => x*2, filtered);
const arr = toArray(mapped);
// Single variable pattern
let _ = new Set([0, -1, 3]);
_ = filter(x => x >= 0, _);
_ = map(x => x * 2, _);
const arr = toArray(_);