diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-09-28 20:08:04 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-09-28 20:08:04 -0700 |
commit | 6c69569a4c4ca3a23635d4d7a40f0fe557194619 (patch) | |
tree | 162ab23faa9fdc402732f35b875b8755bb646b33 /html/edit/005-sandbox.mu.html | |
parent | 6f65d5918f4b73de56e6cb6362c7cbc7dbbe5945 (diff) | |
download | mu-6c69569a4c4ca3a23635d4d7a40f0fe557194619.tar.gz |
3430
Diffstat (limited to 'html/edit/005-sandbox.mu.html')
-rw-r--r-- | html/edit/005-sandbox.mu.html | 143 |
1 files changed, 69 insertions, 74 deletions
diff --git a/html/edit/005-sandbox.mu.html b/html/edit/005-sandbox.mu.html index 6aea4d1f..5afc8a83 100644 --- a/html/edit/005-sandbox.mu.html +++ b/html/edit/005-sandbox.mu.html @@ -14,13 +14,13 @@ pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background- body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color: #080808; } * { font-size: 12pt; font-size: 1em; } .muRecipe { color: #ff8700; } -.muData { color: #ffff00; } .Special { color: #c00000; } .muScenario { color: #00af00; } .Delimiter { color: #800080; } .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .SalientComment { color: #00ffff; } +.muData { color: #ffff00; } .muControl { color: #c0a020; } --> </style> @@ -77,19 +77,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> run-and-show-results [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">15/height</span> <span class="Comment"># recipe editor is empty</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> <span class="Comment"># sandbox editor contains an instruction without storing outputs</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[divide-with-remainder 11, 3]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[divide-with-remainder 11, 3]</span> <span class="Comment"># run the code in the editors</span> assume-console [ press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># check that screen prints the results</span> screen-should-contain [ @@ -135,13 +134,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># run another command</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">80</span> - type <span class="Constant">[add 2, 2]</span> + <span class="muData">type</span> <span class="Constant">[add 2, 2]</span> press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] - <span class="Comment"># check that screen prints the results</span> + <span class="Comment"># check that screen prints both sandboxes</span> screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -551,23 +550,23 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> run-updates-results [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">12/height</span> <span class="Comment"># define a recipe (no indent for the 'add' line below so column numbers are more obvious)</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ </span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo [</span> <span class="Constant">local-scope</span> <span class="Constant">z:num <- add 2, 2</span> <span class="Constant">reply z</span> <span class="Constant">]</span>] <span class="Comment"># sandbox editor contains an instruction without storing outputs</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[foo]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes, <span class="Constant">[foo]</span> <span class="Comment"># run the code in the editors</span> assume-console [ press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -583,11 +582,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color assume-console [ left-click <span class="Constant">4</span>, <span class="Constant">28</span> <span class="Comment"># one past the value of the second arg</span> press backspace - type <span class="Constant">[3]</span> + <span class="muData">type</span> <span class="Constant">[3]</span> press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># check that screen updates the result on the right</span> screen-should-contain [ @@ -604,19 +603,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> run-instruction-manages-screen-per-sandbox [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">20/height</span> <span class="Comment"># left editor is empty</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> <span class="Comment"># right editor contains an instruction</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[print-integer screen, 4]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[print-integer screen, 4]</span> <span class="Comment"># run the code in the editor</span> assume-console [ press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># check that it prints a little toy screen</span> screen-should-contain [ @@ -656,20 +654,20 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-provides-edited-contents [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abc]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">2</span> - type <span class="Constant">[def]</span> + <span class="muData">type</span> <span class="Constant">[def]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:text<span class="Special"> <- </span>editor-contents <span class="Constant">2</span>:&:editor - <span class="Constant">4</span>:@:char<span class="Special"> <- </span>copy *<span class="Constant">3</span>:text + editor-event-loop screen:&:screen, console:&:console, e + s:text<span class="Special"> <- </span>editor-contents e + <span class="Constant">1</span>:@:char/<span class="Special">raw <- </span>copy *s ] memory-should-contain [ - <span class="Constant">4</span>:array:character<span class="Special"> <- </span><span class="Constant">[abdefc]</span> + <span class="Constant">1</span>:array:character<span class="Special"> <- </span><span class="Constant">[abdefc]</span> ] ] @@ -830,18 +828,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># scrolling through sandboxes</span> <span class="muScenario">scenario</span> scrolling-down-past-bottom-of-sandbox-editor [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize sandbox side</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[add 2, 2]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[add 2, 2]</span> + render-all screen, env, render assume-console [ <span class="Comment"># create a sandbox</span> press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -855,9 +852,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-down ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor + event-loop screen:&:screen, console:&:console, env + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] <span class="Comment"># sandbox editor hidden; first sandbox displayed</span> <span class="Comment"># cursor moves to first sandbox</span> @@ -873,9 +870,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-up ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor + event-loop screen:&:screen, console:&:console, env + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] <span class="Comment"># sandbox editor displays again, cursor is in editor</span> screen-should-contain [ @@ -963,27 +960,27 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> scrolling-down-on-recipe-side [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize sandbox side and create a sandbox</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ </span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">]</span> <span class="Comment"># create a sandbox</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[add 2, 2]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes:text, <span class="Constant">[add 2, 2]</span> + render-all screen, env, render assume-console [ press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env <span class="Comment"># hit 'down' in recipe editor</span> assume-console [ press page-down ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor + event-loop screen:&:screen, console:&:console, env + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] <span class="Comment"># cursor moves down on recipe side</span> screen-should-contain [ @@ -996,24 +993,23 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> scrolling-through-multiple-sandboxes [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize environment</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[]</span> + render-all screen, env, render <span class="Comment"># create 2 sandboxes</span> assume-console [ press ctrl-n - type <span class="Constant">[add 2, 2]</span> + <span class="muData">type</span> <span class="Constant">[add 2, 2]</span> press F4 - type <span class="Constant">[add 1, 1]</span> + <span class="muData">type</span> <span class="Constant">[add 1, 1]</span> press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor + event-loop screen:&:screen, console:&:console, env + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊␣ .</span> @@ -1031,9 +1027,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-down ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor + event-loop screen:&:screen, console:&:console, env + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] <span class="Comment"># sandbox editor hidden; first sandbox displayed</span> <span class="Comment"># cursor moves to first sandbox</span> @@ -1053,7 +1049,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-down ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># just second sandbox displayed</span> screen-should-contain [ @@ -1070,7 +1066,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-down ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># no change</span> screen-should-contain [ @@ -1087,7 +1083,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-up ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># back to displaying both sandboxes without editor</span> screen-should-contain [ @@ -1106,9 +1102,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-up ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor + event-loop screen:&:screen, console:&:console, env + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] <span class="Comment"># back to displaying both sandboxes as well as editor</span> screen-should-contain [ @@ -1128,9 +1124,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-up ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor + event-loop screen:&:screen, console:&:console, env + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] <span class="Comment"># no change</span> screen-should-contain [ @@ -1148,20 +1144,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> scrolling-manages-sandbox-index-correctly [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize environment</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[]</span> + render-all screen, env, render <span class="Comment"># create a sandbox</span> assume-console [ press ctrl-n - type <span class="Constant">[add 1, 1]</span> + <span class="muData">type</span> <span class="Constant">[add 1, 1]</span> press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -1177,7 +1172,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-down ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># sandbox editor hidden; first sandbox displayed</span> <span class="Comment"># cursor moves to first sandbox</span> @@ -1195,7 +1190,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-up ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># back to displaying both sandboxes as well as editor</span> screen-should-contain [ @@ -1213,7 +1208,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-down ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># sandbox editor hidden; first sandbox displayed</span> <span class="Comment"># cursor moves to first sandbox</span> |