about summary refs log tree commit diff stats
path: root/edit
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-11-10 19:19:53 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-11-10 19:19:53 -0800
commitc1585c88fa61918a9c464f7d6eb5b1b4b107048b (patch)
treedf2f317f1b5c4edfe21ebb0d9382e9dc68203521 /edit
parentc4e7c10d158fafb2289b2349a2aebe0459b8946f (diff)
downloadmu-c1585c88fa61918a9c464f7d6eb5b1b4b107048b.tar.gz
2417 - support mutable ingredients in headers
If a name repeats between ingredients, we raise an error.
If a name repeats across ingredients and products, every call should
share the same name across the corresponding ingredients and products.
Diffstat (limited to 'edit')
-rw-r--r--edit/002-typing.mu2
-rw-r--r--edit/005-sandbox.mu13
-rw-r--r--edit/006-sandbox-edit.mu8
-rw-r--r--edit/008-sandbox-test.mu10
-rw-r--r--edit/009-sandbox-trace.mu6
5 files changed, 20 insertions, 19 deletions
diff --git a/edit/002-typing.mu b/edit/002-typing.mu
index bd69ae16..e766926a 100644
--- a/edit/002-typing.mu
+++ b/edit/002-typing.mu
@@ -259,7 +259,7 @@ recipe insert-at-cursor editor:address:editor-data, c:character, screen:address:
 ]
 
 # helper for tests
-recipe editor-render screen:address:screen, editor:address:editor-data [
+recipe editor-render screen:address:screen, editor:address:editor-data -> screen:address:screen [
   local-scope
   load-ingredients
   left:number <- get *editor, left:offset
diff --git a/edit/005-sandbox.mu b/edit/005-sandbox.mu
index 22d7ab68..358d148c 100644
--- a/edit/005-sandbox.mu
+++ b/edit/005-sandbox.mu
@@ -391,6 +391,7 @@ scenario run-updates-results [
   1:address:array:character <- new [ 
 recipe foo [
 z:number <- add 2, 2
+reply z
 ]]
   # sandbox editor contains an instruction without storing outputs
   2:address:array:character <- new [foo]
@@ -405,9 +406,9 @@ z:number <- add 2, 2
     .                                                  ┊                                                 .
     .recipe foo [                                      ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
     .z:number <- add 2, 2                              ┊                                                x.
-    .]                                                 ┊foo                                              .
-    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4                                                .
-    .                                                  ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
+    .reply z                                           ┊foo                                              .
+    .]                                                 ┊4                                                .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
     .                                                  ┊                                                 .
   ]
   # make a change (incrementing one of the args to 'add'), then rerun
@@ -426,9 +427,9 @@ z:number <- add 2, 2
     .                                                  ┊                                                 .
     .recipe foo [                                      ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
     .z:number <- add 2, 3                              ┊                                                x.
-    .]                                                 ┊foo                                              .
-    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊5                                                .
-    .                                                  ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
+    .reply z                                           ┊foo                                              .
+    .]                                                 ┊5                                                .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
     .                                                  ┊                                                 .
   ]
 ]
diff --git a/edit/006-sandbox-edit.mu b/edit/006-sandbox-edit.mu
index 6c61916d..6f1af1d6 100644
--- a/edit/006-sandbox-edit.mu
+++ b/edit/006-sandbox-edit.mu
@@ -6,7 +6,7 @@ scenario clicking-on-a-sandbox-moves-it-to-editor [
   # basic recipe
   1:address:array:character <- new [ 
 recipe foo [
-  add 2, 2
+  reply 4
 ]]
   # run it
   2:address:array:character <- new [foo]
@@ -19,7 +19,7 @@ recipe foo [
     .                     run (F4)           .
     .                    ┊                   .
     .recipe foo [        ┊━━━━━━━━━━━━━━━━━━━.
-    .  add 2, 2          ┊                  x.
+    .  reply 4           ┊                  x.
     .]                   ┊foo                .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4                  .
     .                    ┊━━━━━━━━━━━━━━━━━━━.
@@ -37,7 +37,7 @@ recipe foo [
     .                     run (F4)           .
     .                    ┊foo                .
     .recipe foo [        ┊━━━━━━━━━━━━━━━━━━━.
-    .  add 2, 2          ┊                   .
+    .  reply 4           ┊                   .
     .]                   ┊                   .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊                   .
     .                    ┊                   .
@@ -54,7 +54,7 @@ recipe foo [
     .                     run (F4)           .
     .                    ┊0foo               .
     .recipe foo [        ┊━━━━━━━━━━━━━━━━━━━.
-    .  add 2, 2          ┊                   .
+    .  reply 4           ┊                   .
     .]                   ┊                   .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊                   .
     .                    ┊                   .
diff --git a/edit/008-sandbox-test.mu b/edit/008-sandbox-test.mu
index fbc66aad..2c557c17 100644
--- a/edit/008-sandbox-test.mu
+++ b/edit/008-sandbox-test.mu
@@ -6,7 +6,7 @@ scenario sandbox-click-on-result-toggles-color-to-green [
   # basic recipe
   1:address:array:character <- new [ 
 recipe foo [
-  add 2, 2
+  reply 4
 ]]
   # run it
   2:address:array:character <- new [foo]
@@ -19,7 +19,7 @@ recipe foo [
     .                     run (F4)           .
     .                    ┊                   .
     .recipe foo [        ┊━━━━━━━━━━━━━━━━━━━.
-    .  add 2, 2          ┊                  x.
+    .  reply 4           ┊                  x.
     .]                   ┊foo                .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4                  .
     .                    ┊━━━━━━━━━━━━━━━━━━━.
@@ -51,13 +51,13 @@ recipe foo [
     .                     run (F4)           .
     .␣                   ┊                   .
     .recipe foo [        ┊━━━━━━━━━━━━━━━━━━━.
-    .  add 2, 2          ┊                  x.
+    .  reply 4           ┊                  x.
     .]                   ┊foo                .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4                  .
     .                    ┊━━━━━━━━━━━━━━━━━━━.
     .                    ┊                   .
   ]
-  # now change the second arg of the 'add'
+  # now change the result
   # then rerun
   assume-console [
     left-click 3, 11  # cursor to end of line
@@ -75,7 +75,7 @@ recipe foo [
     .                                        .
     .                                        .
     .                                        .
-    .                     5                  .
+    .                     3                  .
     .                                        .
     .                                        .
   ]
diff --git a/edit/009-sandbox-trace.mu b/edit/009-sandbox-trace.mu
index 5e34e8d1..a67dc999 100644
--- a/edit/009-sandbox-trace.mu
+++ b/edit/009-sandbox-trace.mu
@@ -80,7 +80,7 @@ scenario sandbox-shows-app-trace-and-result [
   1:address:array:character <- new [ 
 recipe foo [
   stash [abc]
-  add 2, 2
+  reply 4 
 ]]
   # run it
   2:address:array:character <- new [foo]
@@ -94,7 +94,7 @@ recipe foo [
     .                    ┊                   .
     .recipe foo [        ┊━━━━━━━━━━━━━━━━━━━.
     .  stash [abc]       ┊                  x.
-    .  add 2, 2          ┊foo                .
+    .  reply 4           ┊foo                .
     .]                   ┊4                  .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━.
     .                    ┊                   .
@@ -112,7 +112,7 @@ recipe foo [
     .                    ┊                   .
     .recipe foo [        ┊━━━━━━━━━━━━━━━━━━━.
     .  stash [abc]       ┊                  x.
-    .  add 2, 2          ┊foo                .
+    .  reply 4           ┊foo                .
     .]                   ┊abc                .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4                  .
     .                    ┊━━━━━━━━━━━━━━━━━━━.