Published
Edited
Dec 23, 2020
3 forks
Importers
14 stars
Also listed in…
lib
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
my = {
const mod = (x,y) => ((x % y) + y) % y;
const div = (x,y) => Math.floor(x/y);
function rotate(arr,n) {
const ret = arr.slice(n);
ret.push(...arr.slice(0,n));
return ret;
}
function augment(xy) {
const [x,y] = xy;
return [x,y,-x-y];
}
const scale = (v,a) => v.map(x => x*a);
const add = (v1,v2) => v1.map((x,i) => x+v2[i]);
return {mod,div,rotate,augment,scale,add};
}
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