Published
Edited
Feb 3, 2021
Importers
Insert cell
Insert cell
function o(...fns) {
function makeComposition(x, ...fns) {
let v = x;
for (const fn of fns.reverse()) {
v = fn(v);
}
return v;
}
return x => makeComposition(x, ...fns);
}
Insert cell
Insert cell
fns = ({
f: a => a * 2,
g: a => a + 1,
h: a => a * a,
i: a => a - 1
})
Insert cell
Insert cell
{
const { f, g, h, i } = fns;
return o(f, g, h, i)(5) == f(g(h(i(5))));
}
Insert cell
Insert cell
Insert cell
fairy_and_grass_types = o(
p => p.map(d => d.name[0].toUpperCase() + d.name.slice(1)),
p => p.filter(d => d.types.join(' ').match(/(fairy)|(grass)/))
)(pokemon)
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more