From f2a42df2f33c99a47e0c04d1bc17662f2319b8b1 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Mon, 12 Apr 2021 13:33:32 -0400 Subject: =?UTF-8?q?Add=20=E2=80=A2Show=20to=20REPLs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/repl.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'docs/repl.js') diff --git a/docs/repl.js b/docs/repl.js index ec79324f..40eb6c4f 100644 --- a/docs/repl.js +++ b/docs/repl.js @@ -26,9 +26,11 @@ let repl = ()=>{ setcount(s); setTimeout(() => { try { + let out=[]; sysvals.show = (x,w) => { out.push(x); return x; } let c=compile(src,rt_sys); setExplain(src,c); - doc.rslt.textContent=fmt(run.apply(null,c)); + out.push(run.apply(null,c)); + doc.rslt.textContent=out.map(fmt).join('\n'); } catch(e) { doc.rslt.classList.add('err'); doc.rslt.textContent=fmtErr(src,e); -- cgit v1.2.3