Published
Edited
Sep 7, 2021
10 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
ev('(backtrace)')
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
f_do = {
const skipMarker = Symbol.for('SKIP');
const f_do = async (world, form) => {
console.log('DO');
const oldform = symbolp(car(form));
const once = cadr(form) === null;
const [nspecl, ntestl, ...nbody] = [...iter(form)];
const [ovar, oinit, ostep, otest, ...obody] = [...iter(form)];
const specs = oldform ? [list(ovar, oinit, ostep)] : [...nspecl];
const vars = specs.map(car);
const inits = await evalList(world, specs.map(cadr));
const steps = specs.map(s => (cddr(s) ? car(cddr(s)) : skipMarker));
const [ntest, ...nexitforms] = oldform ? [] : [...ntestl];
const test = once ? LSymbol.T : oldform ? otest : ntest;
const exitforms = oldform ? null : nexitforms;
const body = oldform ? obody : nbody;
const frame = new ApplyFrame(LSymbol.DO, null);
const do_do = async () => {
frame.applyBindings(vars, inits);
while (true) {
if (await world.eval(test)) {
return world.prognBody(exitforms || null);
}
await world.prognBody(body);
let i = 0;
const nvals = [];
for (const nvar of vars) {
const step = steps[i++];
if (step !== skipMarker) {
const nval = await world.eval(step);
if (nvar) {
nvals.push(nval);
}
}
}
frame.applyBindings(vars, nvals);
}
};
return world.withFrame(frame, do_do);
};
return f_do;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
toPath(await L`((teach) lesson progn)`)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
TEACH = PATCHES.ev(`
(progn

(load "attach;boot")
;; Resolve MACAID/DEFMAX circular dependency
;; This will be ovdrwritten by the real definition in MACAID
(defmacro defsimplemac (name varlist &body body)
\`(defmacro name ,varlist, ,@body))

(load "lisp;macaid")
;; SETF has way too many irrelevant dependencies, many of them circular.
;; I've decided implementing my own is far simpler.
;;(load "nilcom;setf")
(load "teach;start")
)`)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Inspector = (await require('@observablehq/inspector')).Inspector
Insert cell
typeof Inspector.Inspector
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more