Published
Edited
Apr 17, 2020
1 fork
1 star
Insert cell
Insert cell
function fib(n) {
return n <= 1 ? 1 : fib(n - 1) + fib(n - 2);
}
Insert cell
Insert cell
a = perf(fib, n)
Insert cell
Insert cell
Insert cell
Insert cell
b = perf(mem(fib), n)
Insert cell
Insert cell
memfib = {
function fib(n) {
return n <= 1 ? 1 : fib(n - 1) + fib(n - 2);
}
fib = mem(fib);
return fib;
}
Insert cell
Insert cell
Insert cell
Insert cell
{
// Error
fib = mem(fib);
return fib;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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