about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-05-27 00:52:28 -0700
committerKartik K. Agaram <vc@akkartik.com>2017-05-27 00:52:28 -0700
commit898f03cc3b8a7261104730518a6cf1b6eae9f6f5 (patch)
tree2cde7e1d29aaaf8bc8465a7339a70ad55f6216d4
parentaac76bca12c9fc60af15219d4d93d92699743ac1 (diff)
downloadmu-898f03cc3b8a7261104730518a6cf1b6eae9f6f5.tar.gz
3881 - allow students to turn sandboxes into recipes
Thanks Juan Crispin Hernandez for the suggestion.
-rw-r--r--064list.mu15
-rw-r--r--065duplex_list.mu76
-rw-r--r--edit/005-sandbox.mu76
-rw-r--r--edit/006-sandbox-copy.mu136
-rw-r--r--edit/007-sandbox-delete.mu34
-rw-r--r--edit/008-sandbox-edit.mu22
-rw-r--r--edit/009-sandbox-test.mu4
-rw-r--r--edit/010-sandbox-trace.mu14
-rw-r--r--edit/011-errors.mu16
-rw-r--r--sandbox/005-sandbox.mu10
10 files changed, 302 insertions, 101 deletions
diff --git a/064list.mu b/064list.mu
index c26b302a..47d47754 100644
--- a/064list.mu
+++ b/064list.mu
@@ -276,7 +276,7 @@ def reverse list:&:list:_elem temp:&:list:_elem/contained-in:result -> result:&:
 
 scenario reverse-list [
   local-scope
-  list:&:list:number <- push 1, 0
+  list:&:list:num <- push 1, 0
   list <- push 2, list
   list <- push 3, list
   run [
@@ -290,6 +290,19 @@ scenario reverse-list [
   ]
 ]
 
+scenario stash-list [
+  local-scope
+  list:&:list:num <- push 1, 0
+  list <- push 2, list
+  list <- push 3, list
+  run [
+    stash [list:], list
+  ]
+  trace-should-contain [
+    app: list: 3 -> 2 -> 1
+  ]
+]
+
 def to-text in:&:list:_elem -> result:text [
   local-scope
   load-ingredients
diff --git a/065duplex_list.mu b/065duplex_list.mu
index dea42fbc..4b16a870 100644
--- a/065duplex_list.mu
+++ b/065duplex_list.mu
@@ -573,3 +573,79 @@ def dump-from x:&:duplex-list:_elem [
   }
   $print 10/newline, [---], 10/newline
 ]
+
+scenario stash-duplex-list [
+  local-scope
+  list:&:duplex-list:num <- push 1, 0
+  list <- push 2, list
+  list <- push 3, list
+  run [
+    stash [list:], list
+  ]
+  trace-should-contain [
+    app: list: 3 <-> 2 <-> 1
+  ]
+]
+
+def to-text in:&:duplex-list:_elem -> result:text [
+  local-scope
+  load-ingredients
+  buf:&:buffer:char <- new-buffer 80
+  buf <- to-buffer in, buf
+  result <- buffer-to-array buf
+]
+
+# variant of 'to-text' which stops printing after a few elements (and so is robust to cycles)
+def to-text-line in:&:duplex-list:_elem -> result:text [
+  local-scope
+  load-ingredients
+  buf:&:buffer:char <- new-buffer 80
+  buf <- to-buffer in, buf, 6  # max elements to display
+  result <- buffer-to-array buf
+]
+
+def to-buffer in:&:duplex-list:_elem, buf:&:buffer:char -> buf:&:buffer:char [
+  local-scope
+  load-ingredients
+  {
+    break-if in
+    buf <- append buf, [[]]
+    return
+  }
+  # append in.value to buf
+  val:_elem <- get *in, value:offset
+  buf <- append buf, val
+  # now prepare next
+  next:&:duplex-list:_elem <- next in
+  nextn:num <- copy next
+  return-unless next
+  buf <- append buf, [ <-> ]
+  # and recurse
+  remaining:num, optional-ingredient-found?:bool <- next-ingredient
+  {
+    break-if optional-ingredient-found?
+    # unlimited recursion
+    buf <- to-buffer next, buf
+    return
+  }
+  {
+    break-unless remaining
+    # limited recursion
+    remaining <- subtract remaining, 1
+    buf <- to-buffer next, buf, remaining
+    return
+  }
+  # past recursion depth; insert ellipses and stop
+  append buf, [...]
+]
+
+scenario stash-empty-duplex-list [
+  local-scope
+  x:&:duplex-list:num <- copy 0
+  run [
+    stash x
+  ]
+  trace-should-contain [
+    app: []
+  ]
+]
diff --git a/edit/005-sandbox.mu b/edit/005-sandbox.mu
index 27b4a2ec..8db55206 100644
--- a/edit/005-sandbox.mu
+++ b/edit/005-sandbox.mu
@@ -59,7 +59,7 @@ scenario run-and-show-results [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊divide-with-remainder 11, 3                      .
     .                                                  ┊3                                                .
     .                                                  ┊2                                                .
@@ -93,7 +93,7 @@ scenario run-and-show-results [
     .                                                                                                    .
     .                                                                                                    .
     .                                                                                                    .
-    .                                                   0   edit          copy            delete         .
+    .                                                   0   edit       copy       to recipe    delete    .
   ]
   # run another command
   assume-console [
@@ -109,11 +109,11 @@ scenario run-and-show-results [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
     .                                                  ┊─────────────────────────────────────────────────.
-    .                                                  ┊1   edit          copy            delete         .
+    .                                                  ┊1   edit       copy       to recipe    delete    .
     .                                                  ┊divide-with-remainder 11, 3                      .
     .                                                  ┊3                                                .
     .                                                  ┊2                                                .
@@ -320,14 +320,16 @@ def render-sandbox-menu screen:&:screen, sandbox-index:num, left:num, right:num
   local-scope
   load-ingredients
   move-cursor-to-column screen, left
-  edit-button-left:num, edit-button-right:num, copy-button-left:num, copy-button-right:num, delete-button-left:num <- sandbox-menu-columns left, right
+  edit-button-left:num, edit-button-right:num, copy-button-left:num, copy-button-right:num, recipe-button-left:num, recipe-button-right:num, delete-button-left:num <- sandbox-menu-columns left, right
   print screen, sandbox-index, 232/dark-grey, 245/grey
   start-buttons:num <- subtract edit-button-left, 1
   clear-line-until screen, start-buttons, 245/grey
-  print screen, [edit], 232/black, 94/background-orange
-  clear-line-until screen, edit-button-right, 94/background-orange
+  print screen, [edit], 232/black, 25/background-blue
+  clear-line-until screen, edit-button-right, 25/background-blue
   print screen, [copy], 232/black, 58/background-green
   clear-line-until screen, copy-button-right, 58/background-green
+  print screen, [to recipe], 232/black, 94/background-orange
+  clear-line-until screen, recipe-button-right, 94/background-orange
   print screen, [delete], 232/black, 52/background-red
   clear-line-until screen, right, 52/background-red
 ]
@@ -335,19 +337,21 @@ def render-sandbox-menu screen:&:screen, sandbox-index:num, left:num, right:num
 # divide up the menu bar for a sandbox into 3 segments, for edit/copy/delete buttons
 # delete-button-right == right
 # all left/right pairs are inclusive
-def sandbox-menu-columns left:num, right:num -> edit-button-left:num, edit-button-right:num, copy-button-left:num, copy-button-right:num, delete-button-left:num [
+def sandbox-menu-columns left:num, right:num -> edit-button-left:num, edit-button-right:num, copy-button-left:num, copy-button-right:num, recipe-button-left:num, recipe-button-right:num, delete-button-left:num [
   local-scope
   load-ingredients
   start-buttons:num <- add left, 4/space-for-sandbox-index
   buttons-space:num <- subtract right, start-buttons
-  button-width:num <- divide-with-remainder buttons-space, 3  # integer division
-  buttons-wide-enough?:bool <- greater-or-equal button-width, 8
-  assert buttons-wide-enough?, [sandbox must be at least 30 or so characters wide]
+  button-width:num <- divide-with-remainder buttons-space, 4  # integer division
+  buttons-wide-enough?:bool <- greater-or-equal button-width, 10
+  assert buttons-wide-enough?, [sandbox must be at least 40 or so characters wide]
   edit-button-left:num <- copy start-buttons
   copy-button-left:num <- add start-buttons, button-width
   edit-button-right:num <- subtract copy-button-left, 1
-  delete-button-left:num <- subtract right, button-width
-  copy-button-right:num <- subtract delete-button-left, 1
+  recipe-button-left:num <- add copy-button-left, button-width
+  copy-button-right:num <- subtract recipe-button-left, 1
+  delete-button-left:num <- subtract right, button-width, -2  # because 'to recipe' is wider than 'delete'
+  recipe-button-right:num <- subtract delete-button-left, 1
 ]
 
 # print a text 's' to 'editor' in 'color' starting at 'row'
@@ -556,7 +560,7 @@ scenario run-updates-results [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .recipe foo [                                      ┊─────────────────────────────────────────────────.
-    .  local-scope                                     ┊0   edit          copy            delete         .
+    .  local-scope                                     ┊0   edit       copy       to recipe    delete    .
     .  z:num <- add 2, 2                               ┊foo                                              .
     .  reply z                                         ┊4                                                .
     .]                                                 ┊─────────────────────────────────────────────────.
@@ -579,7 +583,7 @@ scenario run-updates-results [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .recipe foo [                                      ┊─────────────────────────────────────────────────.
-    .  local-scope                                     ┊0   edit          copy            delete         .
+    .  local-scope                                     ┊0   edit       copy       to recipe    delete    .
     .  z:num <- add 2, 3                               ┊foo                                              .
     .  reply z                                         ┊5                                                .
     .]                                                 ┊─────────────────────────────────────────────────.
@@ -610,7 +614,7 @@ scenario run-instruction-manages-screen-per-sandbox [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊print screen, 4                                  .
     .                                                  ┊screen:                                          .
     .                                                  ┊  .4                             .               .
@@ -842,7 +846,7 @@ scenario scrolling-down-past-bottom-of-sandbox-editor [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
   ]
   # switch to sandbox window and hit 'page-down'
@@ -860,7 +864,7 @@ scenario scrolling-down-past-bottom-of-sandbox-editor [
   screen-should-contain [
     .                                                                                 run (F4)           .
     .                                                  ┊─────────────────────────────────────────────────.
-    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊␣   edit          copy            delete         .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊␣   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
   ]
@@ -878,7 +882,7 @@ scenario scrolling-down-past-bottom-of-sandbox-editor [
     .                                                                                 run (F4)           .
     .                                                  ┊␣                                                .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
   ]
 ]
@@ -987,7 +991,7 @@ scenario scrolling-down-past-bottom-on-recipe-side [
     .                                                                                 run (F4)           .
     .␣                                                 ┊                                                 .
     .                                                  ┊─────────────────────────────────────────────────.
-    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit          copy            delete         .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
   ]
 ]
@@ -1016,11 +1020,11 @@ scenario scrolling-through-multiple-sandboxes [
     .                                                                                 run (F4)           .
     .                                                  ┊␣                                                .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
-    .                                                  ┊1   edit          copy            delete         .
+    .                                                  ┊1   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
   ]
@@ -1038,11 +1042,11 @@ scenario scrolling-through-multiple-sandboxes [
   screen-should-contain [
     .                                                                                 run (F4)           .
     .                                                  ┊─────────────────────────────────────────────────.
-    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊␣   edit          copy            delete         .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊␣   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
-    .                                                  ┊1   edit          copy            delete         .
+    .                                                  ┊1   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
   ]
@@ -1057,7 +1061,7 @@ scenario scrolling-through-multiple-sandboxes [
   screen-should-contain [
     .                                                                                 run (F4)           .
     .                                                  ┊─────────────────────────────────────────────────.
-    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1   edit          copy            delete         .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -1074,7 +1078,7 @@ scenario scrolling-through-multiple-sandboxes [
   screen-should-contain [
     .                                                                                 run (F4)           .
     .                                                  ┊─────────────────────────────────────────────────.
-    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1   edit          copy            delete         .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -1091,11 +1095,11 @@ scenario scrolling-through-multiple-sandboxes [
   screen-should-contain [
     .                                                                                 run (F4)           .
     .                                                  ┊─────────────────────────────────────────────────.
-    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit          copy            delete         .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
-    .                                                  ┊1   edit          copy            delete         .
+    .                                                  ┊1   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
   ]
@@ -1113,11 +1117,11 @@ scenario scrolling-through-multiple-sandboxes [
     .                                                                                 run (F4)           .
     .                                                  ┊␣                                                .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
-    .                                                  ┊1   edit          copy            delete         .
+    .                                                  ┊1   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
   ]
@@ -1135,11 +1139,11 @@ scenario scrolling-through-multiple-sandboxes [
     .                                                                                 run (F4)           .
     .                                                  ┊␣                                                .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
-    .                                                  ┊1   edit          copy            delete         .
+    .                                                  ┊1   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
   ]
@@ -1165,7 +1169,7 @@ scenario scrolling-manages-sandbox-index-correctly [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -1183,7 +1187,7 @@ scenario scrolling-manages-sandbox-index-correctly [
   screen-should-contain [
     .                                                                                 run (F4)           .
     .                                                  ┊─────────────────────────────────────────────────.
-    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit          copy            delete         .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -1201,7 +1205,7 @@ scenario scrolling-manages-sandbox-index-correctly [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -1219,7 +1223,7 @@ scenario scrolling-manages-sandbox-index-correctly [
   screen-should-contain [
     .                                                                                 run (F4)           .
     .                                                  ┊─────────────────────────────────────────────────.
-    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit          copy            delete         .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
diff --git a/edit/006-sandbox-copy.mu b/edit/006-sandbox-copy.mu
index d3f82e88..c754e235 100644
--- a/edit/006-sandbox-copy.mu
+++ b/edit/006-sandbox-copy.mu
@@ -18,7 +18,7 @@ scenario copy-a-sandbox-to-editor [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -36,7 +36,7 @@ scenario copy-a-sandbox-to-editor [
     .                                                                                 run (F4)           .
     .                                                  ┊add 1, 1                                         .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -53,7 +53,7 @@ scenario copy-a-sandbox-to-editor [
     .                                                                                 run (F4)           .
     .                                                  ┊0add 1, 1                                        .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -78,7 +78,7 @@ scenario copy-a-sandbox-to-editor-2 [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -86,7 +86,7 @@ scenario copy-a-sandbox-to-editor-2 [
   ]
   # click at right edge of 'copy' button (just before 'delete')
   assume-console [
-    left-click 3, 84
+    left-click 3, 76
   ]
   run [
     event-loop screen, console, env, resources
@@ -96,7 +96,7 @@ scenario copy-a-sandbox-to-editor-2 [
     .                                                                                 run (F4)           .
     .                                                  ┊add 1, 1                                         .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -113,7 +113,7 @@ scenario copy-a-sandbox-to-editor-2 [
     .                                                                                 run (F4)           .
     .                                                  ┊0add 1, 1                                        .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -146,7 +146,7 @@ def should-attempt-copy? click-row:num, click-column:num, env:&:environment -> r
   assert first-sandbox, [!!]
   sandbox-left-margin:num <- get *first-sandbox, left:offset
   sandbox-right-margin:num <- get *first-sandbox, right:offset
-  _, _, copy-button-left:num, copy-button-right:num, _ <- sandbox-menu-columns sandbox-left-margin, sandbox-right-margin
+  _, _, copy-button-left:num, copy-button-right:num <- sandbox-menu-columns sandbox-left-margin, sandbox-right-margin
   copy-button-vertical-area?:bool <- within-range? click-column, copy-button-left, copy-button-right
   return-unless copy-button-vertical-area?, 0/false
   # finally, is sandbox editor empty?
@@ -231,7 +231,7 @@ scenario copy-fails-if-sandbox-editor-not-empty [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -251,7 +251,7 @@ scenario copy-fails-if-sandbox-editor-not-empty [
     .                                                                                 run (F4)           .
     .                                                  ┊0                                                .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -268,10 +268,124 @@ scenario copy-fails-if-sandbox-editor-not-empty [
     .                                                                                 run (F4)           .
     .                                                  ┊01                                               .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
     .                                                  ┊                                                 .
   ]
 ]
+
+## the 'to recipe' button makes it easy to create a function out of a sandbox
+
+scenario copy-a-sandbox-to-recipe-side [
+  local-scope
+  trace-until 100/app  # trace too long
+  assume-screen 100/width, 10/height
+  # empty recipes
+  assume-resources [
+  ]
+  env:&:environment <- new-programming-environment resources, screen, [add 1, 1]  # contents of sandbox editor
+  # run it
+  assume-console [
+    press F4
+  ]
+  event-loop screen, console, env, resources
+  screen-should-contain [
+    .                                                                                 run (F4)           .
+    .                                                  ┊                                                 .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
+    .                                                  ┊0   edit       copy       to recipe    delete    .
+    .                                                  ┊add 1, 1                                         .
+    .                                                  ┊2                                                .
+    .                                                  ┊─────────────────────────────────────────────────.
+    .                                                  ┊                                                 .
+  ]
+  # click at left edge of 'copy' button
+  assume-console [
+    left-click 3, 78
+  ]
+  run [
+    event-loop screen, console, env, resources
+  ]
+  # it copies into recipe side
+  screen-should-contain [
+    .                                                                                 run (F4)           .
+    .add 1, 1                                          ┊                                                 .
+    .                                                  ┊─────────────────────────────────────────────────.
+    .                                                  ┊0   edit       copy       to recipe    delete    .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊add 1, 1                                         .
+    .                                                  ┊2                                                .
+    .                                                  ┊─────────────────────────────────────────────────.
+    .                                                  ┊                                                 .
+  ]
+  # cursor should be at the top left of the recipe side
+  assume-console [
+    type [0]
+  ]
+  run [
+    event-loop screen, console, env, resources
+  ]
+  screen-should-contain [
+    .                                                                                 run (F4)           .
+    .0add 1, 1                                         ┊                                                 .
+    .                                                  ┊─────────────────────────────────────────────────.
+    .                                                  ┊0   edit       copy       to recipe    delete    .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊add 1, 1                                         .
+    .                                                  ┊2                                                .
+    .                                                  ┊─────────────────────────────────────────────────.
+    .                                                  ┊                                                 .
+  ]
+]
+
+after <global-touch> [
+  # support 'copy to recipe' button
+  {
+    copy?:bool <- should-copy-to-recipe? click-row, click-column, env
+    break-unless copy?
+    modified?:bool <- prepend-sandbox-into-recipe-side click-row, env
+    break-unless modified?
+    put *env, sandbox-in-focus?:offset, 0/false
+    screen <- render-recipes screen, env, render
+    screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env
+    loop +next-event
+  }
+]
+
+# some preconditions for attempting to copy a sandbox into the recipe side
+def should-copy-to-recipe? click-row:num, click-column:num, env:&:environment -> result:bool [
+  local-scope
+  load-ingredients
+  # are we below the sandbox editor?
+  click-sandbox-area?:bool <- click-on-sandbox-area? click-row, click-column, env
+  return-unless click-sandbox-area?, 0/false
+  # narrower, is the click in the columns spanning the 'copy' button?
+  first-sandbox:&:editor <- get *env, current-sandbox:offset
+  assert first-sandbox, [!!]
+  sandbox-left-margin:num <- get *first-sandbox, left:offset
+  sandbox-right-margin:num <- get *first-sandbox, right:offset
+  _, _, _, _, recipe-button-left:num, recipe-button-right:num <- sandbox-menu-columns sandbox-left-margin, sandbox-right-margin
+  result <- within-range? click-column, recipe-button-left, recipe-button-right
+]
+
+def prepend-sandbox-into-recipe-side click-row:num, env:&:environment -> clicked-on-copy-to-recipe-button?:bool, env:&:environment [
+  local-scope
+  load-ingredients
+  sandbox:&:sandbox <- find-sandbox env, click-row
+  return-unless sandbox, 0/false
+  recipe-editor:&:editor <- get *env, recipes:offset
+  recipe-data:&:duplex-list:char <- get *recipe-editor, data:offset
+  # make the newly inserted code easy to delineate
+  newline:char <- copy 10
+  insert newline, recipe-data
+  insert newline, recipe-data
+  # insert code from the selected sandbox
+  sandbox-data:text <- get *sandbox, data:offset
+  insert recipe-data, sandbox-data
+  # reset cursor
+  put *recipe-editor, top-of-screen:offset, recipe-data
+  put *recipe-editor, before-cursor:offset, recipe-data
+  put *recipe-editor, cursor-row:offset, 1
+  put *recipe-editor, cursor-column:offset, 0
+  return 1/true
+]
diff --git a/edit/007-sandbox-delete.mu b/edit/007-sandbox-delete.mu
index 5167b038..4e10aa42 100644
--- a/edit/007-sandbox-delete.mu
+++ b/edit/007-sandbox-delete.mu
@@ -9,7 +9,7 @@ scenario deleting-sandboxes [
   env:&:environment <- new-programming-environment resources, screen, []
   # run a few commands
   assume-console [
-    left-click 1, 80
+    left-click 1, 75
     type [divide-with-remainder 11, 3]
     press F4
     type [add 2, 2]
@@ -20,11 +20,11 @@ scenario deleting-sandboxes [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
     .                                                  ┊─────────────────────────────────────────────────.
-    .                                                  ┊1   edit          copy            delete         .
+    .                                                  ┊1   edit       copy       to recipe    delete    .
     .                                                  ┊divide-with-remainder 11, 3                      .
     .                                                  ┊3                                                .
     .                                                  ┊2                                                .
@@ -33,7 +33,7 @@ scenario deleting-sandboxes [
   ]
   # delete second sandbox by clicking on left edge of 'delete' button
   assume-console [
-    left-click 7, 85
+    left-click 7, 90
   ]
   run [
     event-loop screen, console, env, resources
@@ -42,7 +42,7 @@ scenario deleting-sandboxes [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -90,7 +90,7 @@ def should-attempt-delete? click-row:num, click-column:num, env:&:environment ->
   assert first-sandbox, [!!]
   sandbox-left-margin:num <- get *first-sandbox, left:offset
   sandbox-right-margin:num <- get *first-sandbox, right:offset
-  _, _, _, _, delete-button-left:num <- sandbox-menu-columns sandbox-left-margin, sandbox-right-margin
+  _, _, _, _, _, _, delete-button-left:num <- sandbox-menu-columns sandbox-left-margin, sandbox-right-margin
   result <- within-range? click-column, delete-button-left, sandbox-right-margin
 ]
 
@@ -168,11 +168,11 @@ scenario deleting-sandbox-after-scroll [
   screen-should-contain [
     .                                                                                 run (F4)           .
     .                                                  ┊─────────────────────────────────────────────────.
-    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit          copy            delete         .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
-    .                                                  ┊1   edit          copy            delete         .
+    .                                                  ┊1   edit       copy       to recipe    delete    .
   ]
   # delete the second sandbox
   assume-console [
@@ -185,7 +185,7 @@ scenario deleting-sandbox-after-scroll [
   screen-should-contain [
     .                                                                                 run (F4)           .
     .                                                  ┊─────────────────────────────────────────────────.
-    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit          copy            delete         .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -215,11 +215,11 @@ scenario deleting-top-sandbox-after-scroll [
   screen-should-contain [
     .                                                                                 run (F4)           .
     .                                                  ┊─────────────────────────────────────────────────.
-    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit          copy            delete         .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
-    .                                                  ┊1   edit          copy            delete         .
+    .                                                  ┊1   edit       copy       to recipe    delete    .
   ]
   # delete the second sandbox
   assume-console [
@@ -232,7 +232,7 @@ scenario deleting-top-sandbox-after-scroll [
   screen-should-contain [
     .                                                                                 run (F4)           .
     .                                                  ┊─────────────────────────────────────────────────.
-    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit          copy            delete         .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -263,7 +263,7 @@ scenario deleting-final-sandbox-after-scroll [
   screen-should-contain [
     .                                                                                 run (F4)           .
     .                                                  ┊─────────────────────────────────────────────────.
-    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1   edit          copy            delete         .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -281,7 +281,7 @@ scenario deleting-final-sandbox-after-scroll [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -311,11 +311,11 @@ scenario deleting-updates-sandbox-count [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
-    .                                                  ┊1   edit          copy            delete         .
+    .                                                  ┊1   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
   ]
@@ -332,7 +332,7 @@ scenario deleting-updates-sandbox-count [
   screen-should-contain [
     .                                                                                 run (F4)           .
     .                                                  ┊─────────────────────────────────────────────────.
-    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit          copy            delete         .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
     .                                                  ┊─────────────────────────────────────────────────.
diff --git a/edit/008-sandbox-edit.mu b/edit/008-sandbox-edit.mu
index 2d591ad6..9a2b0e7a 100644
--- a/edit/008-sandbox-edit.mu
+++ b/edit/008-sandbox-edit.mu
@@ -17,7 +17,7 @@ scenario clicking-on-sandbox-edit-button-moves-it-to-editor [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -69,7 +69,7 @@ scenario clicking-on-sandbox-edit-button-moves-it-to-editor-2 [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -77,7 +77,7 @@ scenario clicking-on-sandbox-edit-button-moves-it-to-editor-2 [
   ]
   # click at right edge of 'edit' button (just before 'copy')
   assume-console [
-    left-click 3, 68
+    left-click 3, 65
   ]
   run [
     event-loop screen, console, env, resources
@@ -173,7 +173,7 @@ scenario sandbox-with-print-can-be-edited [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊print screen, 4                                  .
     .                                                  ┊screen:                                          .
     .                                                  ┊  .4                             .               .
@@ -223,7 +223,7 @@ scenario editing-sandbox-after-scrolling-resets-scroll [
   screen-should-contain [
     .                                                                                 run (F4)           .
     .                                                  ┊─────────────────────────────────────────────────.
-    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1   edit          copy            delete         .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -241,7 +241,7 @@ scenario editing-sandbox-after-scrolling-resets-scroll [
     .                                                                                 run (F4)           .
     .                                                  ┊add 2, 2                                         .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -271,11 +271,11 @@ scenario editing-sandbox-updates-sandbox-count [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
-    .                                                  ┊1   edit          copy            delete         .
+    .                                                  ┊1   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
   ]
@@ -292,11 +292,11 @@ scenario editing-sandbox-updates-sandbox-count [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 1, 1                                         .
     .                                                  ┊2                                                .
     .                                                  ┊─────────────────────────────────────────────────.
-    .                                                  ┊1   edit          copy            delete         .
+    .                                                  ┊1   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
   ]
@@ -313,7 +313,7 @@ scenario editing-sandbox-updates-sandbox-count [
   screen-should-contain [
     .                                                                                 run (F4)           .
     .                                                  ┊─────────────────────────────────────────────────.
-    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1   edit          copy            delete         .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
     .                                                  ┊─────────────────────────────────────────────────.
diff --git a/edit/009-sandbox-test.mu b/edit/009-sandbox-test.mu
index badd795b..cccee3e0 100644
--- a/edit/009-sandbox-test.mu
+++ b/edit/009-sandbox-test.mu
@@ -22,7 +22,7 @@ scenario sandbox-click-on-result-toggles-color-to-green [
     .                                                                                 run (F4)           .
     .recipe foo [                                      ┊                                                 .
     .  reply 4                                         ┊─────────────────────────────────────────────────.
-    .]                                                 ┊0   edit          copy            delete         .
+    .]                                                 ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊foo                                              .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -55,7 +55,7 @@ scenario sandbox-click-on-result-toggles-color-to-green [
     .                                                                                 run (F4)           .
     .␣ecipe foo [                                      ┊                                                 .
     .  reply 4                                         ┊─────────────────────────────────────────────────.
-    .]                                                 ┊0   edit          copy            delete         .
+    .]                                                 ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊foo                                              .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4                                                .
     .                                                  ┊─────────────────────────────────────────────────.
diff --git a/edit/010-sandbox-trace.mu b/edit/010-sandbox-trace.mu
index 8088577a..2c136587 100644
--- a/edit/010-sandbox-trace.mu
+++ b/edit/010-sandbox-trace.mu
@@ -22,7 +22,7 @@ scenario sandbox-click-on-code-toggles-app-trace [
     .                                                                                 run (F4)           .
     .recipe foo [                                      ┊                                                 .
     .  stash [abc]                                     ┊─────────────────────────────────────────────────.
-    .]                                                 ┊0   edit          copy            delete         .
+    .]                                                 ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊foo                                              .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
     .                                                  ┊                                                 .
@@ -41,7 +41,7 @@ scenario sandbox-click-on-code-toggles-app-trace [
     .                                                                                 run (F4)           .
     .␣ecipe foo [                                      ┊                                                 .
     .  stash [abc]                                     ┊─────────────────────────────────────────────────.
-    .]                                                 ┊0   edit          copy            delete         .
+    .]                                                 ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊foo                                              .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊abc                                              .
   ]
@@ -66,7 +66,7 @@ scenario sandbox-click-on-code-toggles-app-trace [
     .                                                                                 run (F4)           .
     .␣ecipe foo [                                      ┊                                                 .
     .  stash [abc]                                     ┊─────────────────────────────────────────────────.
-    .]                                                 ┊0   edit          copy            delete         .
+    .]                                                 ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊foo                                              .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
     .                                                  ┊                                                 .
@@ -96,7 +96,7 @@ scenario sandbox-shows-app-trace-and-result [
     .                                                                                 run (F4)           .
     .recipe foo [                                      ┊                                                 .
     .  stash [abc]                                     ┊─────────────────────────────────────────────────.
-    .  reply 4                                         ┊0   edit          copy            delete         .
+    .  reply 4                                         ┊0   edit       copy       to recipe    delete    .
     .]                                                 ┊foo                                              .
     .                                                  ┊4                                                .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
@@ -114,7 +114,7 @@ scenario sandbox-shows-app-trace-and-result [
     .                                                                                 run (F4)           .
     .recipe foo [                                      ┊                                                 .
     .  stash [abc]                                     ┊─────────────────────────────────────────────────.
-    .  reply 4                                         ┊0   edit          copy            delete         .
+    .  reply 4                                         ┊0   edit       copy       to recipe    delete    .
     .]                                                 ┊foo                                              .
     .                                                  ┊abc                                              .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊8 instructions run                               .
@@ -141,7 +141,7 @@ scenario clicking-on-app-trace-does-nothing [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊stash 123456789                                  .
     .                                                  ┊123456789                                        .
   ]
@@ -157,7 +157,7 @@ scenario clicking-on-app-trace-does-nothing [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊stash 123456789                                  .
     .                                                  ┊123456789                                        .
   ]
diff --git a/edit/011-errors.mu b/edit/011-errors.mu
index ad4d8836..8c423106 100644
--- a/edit/011-errors.mu
+++ b/edit/011-errors.mu
@@ -245,7 +245,7 @@ scenario run-hides-errors-from-past-sandboxes [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊add 2, 2                                         .
     .                                                  ┊4                                                .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -277,7 +277,7 @@ scenario run-updates-errors-for-shape-shifting-recipes [
     .  errors found (0)                                                               run (F4)           .
     .recipe foo x:_elem -> z:_elem [                   ┊                                                 .
     .  local-scope                                     ┊─────────────────────────────────────────────────.
-    .  load-ingredients                                ┊0   edit          copy            delete         .
+    .  load-ingredients                                ┊0   edit       copy       to recipe    delete    .
     .  y:&:num <- copy 0                               ┊foo 2                                            .
     .  z <- add x, y                                   ┊foo_2: 'add' requires number ingredients, but go↩.
     .]                                                 ┊t 'y'                                            .
@@ -297,7 +297,7 @@ scenario run-updates-errors-for-shape-shifting-recipes [
     .  errors found (0)                                                               run (F4)           .
     .recipe foo x:_elem -> z:_elem [                   ┊                                                 .
     .  local-scope                                     ┊─────────────────────────────────────────────────.
-    .  load-ingredients                                ┊0   edit          copy            delete         .
+    .  load-ingredients                                ┊0   edit       copy       to recipe    delete    .
     .  y:&:num <- copy 0                               ┊foo 2                                            .
     .  z <- add x, y                                   ┊foo_3: 'add' requires number ingredients, but go↩.
     .]                                                 ┊t 'y'                                            .
@@ -574,7 +574,7 @@ scenario run-instruction-and-print-errors [
     .  errors found (0)                                                               run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊get 1234:num, foo:offset                         .
     .                                                  ┊unknown element 'foo' in container 'number'      .
     .                                                  ┊first ingredient of 'get' should be a container,↩.
@@ -638,7 +638,7 @@ scenario run-instruction-and-print-errors-only-once [
     .  errors found (0)                                                               run (F4)           .
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
-    .                                                  ┊0   edit          copy            delete         .
+    .                                                  ┊0   edit       copy       to recipe    delete    .
     .                                                  ┊get 1234:num, foo:offset                         .
     .                                                  ┊unknown element 'foo' in container 'number'      .
     .                                                  ┊first ingredient of 'get' should be a container,↩.
@@ -674,7 +674,7 @@ scenario sandbox-can-handle-infinite-loop [
     .  errors found (0)                                                               run (F4)           .
     .recipe foo [                                      ┊                                                 .
     .  {                                               ┊─────────────────────────────────────────────────.
-    .    loop                                          ┊0   edit          copy            delete         .
+    .    loop                                          ┊0   edit       copy       to recipe    delete    .
     .  }                                               ┊foo                                              .
     .]                                                 ┊took too long!                                   .
     .                                                  ┊─────────────────────────────────────────────────.
@@ -711,7 +711,7 @@ scenario sandbox-with-errors-shows-trace [
     .  errors found (0)                                                               run (F4)           .
     .recipe foo [                                      ┊                                                 .
     .  local-scope                                     ┊─────────────────────────────────────────────────.
-    .  a:num <- next-ingredient                        ┊0   edit          copy            delete         .
+    .  a:num <- next-ingredient                        ┊0   edit       copy       to recipe    delete    .
     .  b:num <- next-ingredient                        ┊foo 4, 0                                         .
     .  stash [dividing by], b                          ┊foo: divide by zero in '_, c:num <- divide-with-↩.
     .  _, c:num <- divide-with-remainder a, b          ┊remainder a, b'                                  .
@@ -731,7 +731,7 @@ scenario sandbox-with-errors-shows-trace [
     .  errors found (0)                                                               run (F4)           .
     .recipe foo [                                      ┊                                                 .
     .  local-scope                                     ┊─────────────────────────────────────────────────.
-    .  a:num <- next-ingredient                        ┊0   edit          copy            delete         .
+    .  a:num <- next-ingredient                        ┊0   edit       copy       to recipe    delete    .
     .  b:num <- next-ingredient                        ┊foo 4, 0                                         .
     .  stash [dividing by], b                          ┊dividing by 0                                    .
     .  _, c:num <- divide-with-remainder a, b          ┊14 instructions run                              .
diff --git a/sandbox/005-sandbox.mu b/sandbox/005-sandbox.mu
index 0be2ca31..b0b28ead 100644
--- a/sandbox/005-sandbox.mu
+++ b/sandbox/005-sandbox.mu
@@ -314,16 +314,10 @@ def render-sandbox-menu screen:&:screen, sandbox-index:num, left:num, right:num
   print screen, sandbox-index, 232/dark-grey, 245/grey
   start-buttons:num <- subtract edit-button-left, 1
   clear-line-until screen, start-buttons, 245/grey
-  print screen, [edit], 232/black, 94/background-orange
-  clear-line-until screen, edit-button-right, 94/background-orange
-  _, col:num <- cursor-position screen
-  at-start-of-copy-button?:bool <- equal col, copy-button-left
-  assert at-start-of-copy-button?, [aaa]
+  print screen, [edit], 232/black, 25/background-blue
+  clear-line-until screen, edit-button-right, 25/background-blue
   print screen, [copy], 232/black, 58/background-green
   clear-line-until screen, copy-button-right, 58/background-green
-  _, col:num <- cursor-position screen
-  at-start-of-delete-button?:bool <- equal col, delete-button-left
-  assert at-start-of-delete-button?, [bbb]
   print screen, [delete], 232/black, 52/background-red
   clear-line-until screen, right, 52/background-red
 ]