aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-04-12 21:49:10 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-04-12 21:52:36 -0400
commit1fffae50b765419864451975ef1049aa4a6ec08a (patch)
treea78e3da59f07135e1867782b5e9910d892e443f6 /docs
parentd23e345e929f6eb62cb12b72b07079b1efe5cfc6 (diff)
Add very basic SVG •Plot to the REPL
Diffstat (limited to 'docs')
-rw-r--r--docs/repl.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/repl.js b/docs/repl.js
index e3a4febd..3474133d 100644
--- a/docs/repl.js
+++ b/docs/repl.js
@@ -64,6 +64,18 @@ if (doc.doexplain) doc.doexplain.onclick = () => {
? explain : (e=>e);
}
+let makePlot;
+sysvals.plot = (x,w) => {
+ if (!makePlot) makePlot = run(
+ [0,19,22,0,0,11,22,0,1,11,14,15,1,22,0,2,11,14,15,2,22,0,3,11,14,15,3,22,0,4,11,14,15,4,22,0,5,11,14,0,20,0,38,21,0,5,8,0,30,9,0,20,0,42,31,0,5,8,15,5,3,3,0,44,0,16,0,5,0,48,19,8,22,0,6,11,14,21,0,6,21,0,6,0,35,0,21,7,0,57,19,0,21,9,0,24,0,47,19,15,6,3,3,0,44,0,16,0,5,0,48,19,8,22,0,7,11,14,0,36,15,7,7,0,21,0,70,19,22,0,8,11,14,0,47,0,45,21,0,8,0,38,0,11,8,8,0,21,9,0,41,0,21,8,22,0,9,11,14,15,8,22,0,10,11,14,21,0,6,0,34,0,22,7,0,73,0,74,3,2,19,22,0,11,11,14,21,0,9,0,38,31,0,4,8,22,0,12,11,14,15,9,22,0,13,11,14,0,55,0,20,0,48,17,22,0,14,11,14,0,53,0,20,0,48,17,22,0,15,11,14,0,77,21,0,10,16,22,0,16,11,14,0,78,21,0,10,16,22,0,17,11,14,0,80,31,0,10,0,79,17,22,0,18,11,14,15,10,22,0,19,11,25,0,47,0,18,21,0,2,17,0,46,0,17,0,33,0,20,7,0,47,0,48,3,2,19,0,41,0,33,0,35,0,24,0,21,0,63,19,0,21,0,23,19,7,7,8,8,22,0,3,11,14,21,0,1,21,1,1,0,40,21,1,0,0,30,0,42,31,0,3,8,9,0,21,0,40,0,11,8,0,35,0,47,7,19,8,16,25,15,11,22,0,3,11,14,0,64,21,0,2,0,65,3,3,0,21,16,22,0,4,11,14,0,66,21,0,2,0,28,0,57,0,13,21,0,2,17,0,37,0,9,7,16,17,0,65,3,3,0,21,16,22,0,5,11,14,21,0,1,0,16,16,22,0,6,11,0,11,0,47,17,22,0,7,11,14,31,0,5,21,0,7,0,46,0,11,0,38,0,20,8,8,0,39,15,12,21,0,1,31,0,7,0,46,15,13,8,16,7,8,31,0,4,17,0,21,16,25,0,64,21,0,1,0,68,3,3,0,21,16,25,21,0,1,0,52,0,41,0,11,8,0,9,0,11,0,40,0,51,8,19,16,0,36,0,9,7,16,0,32,16,14,0,53,22,0,3,11,0,33,0,4,7,0,49,17,22,0,4,11,14,0,58,0,1,0,69,17,22,0,5,22,0,6,4,2,11,14,0,50,0,11,21,0,1,17,22,0,7,11,14,21,0,1,0,7,16,22,0,8,11,14,31,0,8,0,2,21,0,4,17,0,0,0,54,17,0,5,16,22,0,9,11,14,31,0,7,0,28,16,0,35,31,0,5,7,0,41,0,11,0,39,0,22,8,8,16,0,22,16,21,0,4,0,3,21,0,9,17,0,5,16,15,14,0,40,0,13,0,38,0,25,8,8,16,31,0,9,15,15,0,40,0,13,0,38,0,25,8,8,16,0,13,0,11,0,50,19,0,46,0,21,0,40,0,29,0,38,0,26,0,30,9,0,42,0,35,31,0,6,7,8,8,8,8,16,3,3,0,21,16,0,27,16,0,34,0,21,0,38,0,11,8,7,16,0,36,0,0,0,40,0,58,8,0,41,0,31,8,7,16,25,21,0,1,14,0,50,0,32,16,25,21,0,1,14,0,50,0,32,16,25,21,0,2,0,71,21,0,1,0,72,3,4,0,21,16,25,15,16,22,0,3,11,14,21,0,1,21,0,3,0,60,7,16,0,35,31,0,3,0,59,7,7,16,0,35,21,1,8,7,0,21,9,0,41,0,21,8,0,43,0,12,8,21,0,2,17,25,21,0,1,21,1,3,0,76,21,0,2,21,1,7,16,3,2,21,1,9,0,75,17,17,25,21,0,1,0,50,0,12,0,40,0,61,8,0,36,0,9,7,9,3,2,0,44,0,14,0,14,0,47,19,8,0,39,0,9,0,43,0,19,8,8,21,0,2,17,0,32,0,81,17,14,21,0,1,0,13,0,39,0,16,0,43,0,47,8,8,21,0,2,17,0,32,0,82,17,14,0,19,0,5,0,6,0,40,0,1,8,0,18,19,0,56,19,0,36,0,5,7,0,41,0,1,8,9,0,36,0,6,7,0,41,0,3,8,9,22,0,3,11,14,21,0,1,31,0,3,0,39,0,8,0,41,0,22,8,8,21,0,1,0,18,0,43,0,13,0,38,0,25,8,8,21,0,2,17,17,0,2,21,1,14,17,21,1,6,16,0,35,0,21,7,0,83,17,0,27,16,0,20,16,0,21,16,0,30,0,42,0,62,8,16,22,0,4,11,14,21,1,15,0,0,21,1,14,17,21,1,6,16,0,34,0,22,7,0,85,0,86,3,2,17,0,21,0,48,0,3,21,1,15,17,0,1,16,21,1,11,16,17,0,21,21,1,17,17,21,1,12,0,84,17,31,0,4,0,19,0,11,0,39,0,22,8,0,88,19,0,21,21,1,16,19,21,1,12,0,87,19,16,3,2,21,1,3,21,1,18,17,21,1,13,21,1,15,0,2,0,48,17,0,0,21,1,14,17,0,21,21,1,15,0,1,16,17,17,25,21,0,1,0,20,16,0,50,0,38,0,32,8,0,11,0,20,9,0,19,0,35,21,0,0,7,0,21,9,3,4,0,44,0,16,0,5,0,49,19,8,16,25,21,0,2,21,0,4,21,0,1,3,3,25,21,0,1,0,20,16,21,1,6,0,15,0,49,17,0,46,0,35,21,1,3,7,0,21,9,8,16,0,35,0,21,0,40,0,67,8,7,16,25,21,0,1,0,15,21,1,3,17,22,0,3,11,14,21,0,2,21,0,1,3,2,0,22,0,26,0,30,9,0,42,0,7,0,40,21,1,3,8,8,0,21,0,36,0,28,0,40,21,0,3,8,0,39,21,1,3,0,41,0,3,8,0,5,9,0,41,21,0,0,8,8,7,19,3,2,0,44,31,0,3,0,36,0,10,7,16,8,16,25,21,0,1,0,7,21,1,4,17,22,0,1,12,0,2,16,22,0,3,11,14,21,0,1,0,50,0,48,3,2,0,25,16,0,28,0,40,21,0,3,8,0,39,0,2,0,40,21,1,3,8,0,41,21,0,0,0,21,21,1,4,0,41,0,3,8,0,5,9,0,41,0,11,0,39,0,22,8,8,19,8,8,3,2,0,44,31,0,3,0,36,0,10,7,16,8,21,0,2,17,25,0,31,0,40,0,14,0,40,21,0,1,8,0,1,0,40,0,8,0,2,0,37,0,0,7,19,8,9,8,25]
+ ,[runtime[0],runtime[1],runtime[2],runtime[3],runtime[4],runtime[6],runtime[7],runtime[8],runtime[9],runtime[10],runtime[11],runtime[12],runtime[13],runtime[14],runtime[15],runtime[16],runtime[18],runtime[19],runtime[20],runtime[21],runtime[22],runtime[23],runtime[24],runtime[25],runtime[26],runtime[27],runtime[30],runtime[31],runtime[32],runtime[35],runtime[36],runtime[41],runtime[42],runtime[44],runtime[45],runtime[46],runtime[49],runtime[51],runtime[52],runtime[53],runtime[54],runtime[55],runtime[56],runtime[57],runtime[58],runtime[59],runtime[61],1,2,3,0,-Infinity,Infinity,10,0.5,384,1.0E300,' ','0','=','|','\0','M',str("t"),str("<"),str(">"),str("</"),str(" "),str("/>"),str("-."),str(" "),str("=\'"),str("\'"),str("x"),str("y"),str("svg"),str("viewBox"),str("class=red|style=fill:none|stroke-width=1"),str("class=code|stroke-width=1|rx=5"),str("g"),str("font-family=BQN,monospace|font-size=18px"),str("•Plot: 𝕨 and 𝕩 must be lists of numbers"),str("•Plot: 𝕨 and 𝕩 must have the same length"),str("L "),str("rect"),str("width"),str("height"),str("path"),str("d")]
+ ,[[0,1,0,20],[0,0,273,4],[0,0,360,8],[0,0,480,3],[0,0,493,10],[0,0,744,3],[0,0,754,3],[0,0,764,3],[0,0,780,4],[0,0,831,3],[0,0,856,5],[0,0,1171,3],[1,0,1214,5],[0,0,1226,3],[0,0,1265,4],[0,0,1355,4],[1,1,1456,2]]
+ );
+ doc.explain.innerHTML = makePlot(x,w).map(l=>l.join("")).join("\n");
+ setExplain = () => doc.explain.innerHTML = '';
+ return '\0';
+}
+
let keymode=0; // 1 for backslash
doc.code.onkeydown = ev => {
let k = ev.which;