about summary refs log tree commit diff stats
path: root/sandbox/005-sandbox.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-12-28 08:44:36 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-12-28 08:44:36 -0800
commitbbe0801ab1e0b0859c3529ed33fde40b139addd6 (patch)
treefa534bbbb3b345d154432746cd585f9262bd80cd /sandbox/005-sandbox.mu
parente94453100dda87a42dee36b2671f850ab6824f54 (diff)
downloadmu-bbe0801ab1e0b0859c3529ed33fde40b139addd6.tar.gz
2548 - teach 'print' to print integers
Still can't print non-integer numbers, so this is a bit hacky.

The big consequence is that you can't print literal characters anymore
because of our rules about how we pick which variant to statically
dispatch to. You have to save to a character variable first.

Maybe I can add an annotation to literals..
Diffstat (limited to 'sandbox/005-sandbox.mu')
-rw-r--r--sandbox/005-sandbox.mu15
1 files changed, 9 insertions, 6 deletions
diff --git a/sandbox/005-sandbox.mu b/sandbox/005-sandbox.mu
index db0a195b..a424209a 100644
--- a/sandbox/005-sandbox.mu
+++ b/sandbox/005-sandbox.mu
@@ -234,7 +234,8 @@ recipe render-sandboxes screen:address:screen, sandbox:address:sandbox-data, lef
   row <- add row, 1
   screen <- move-cursor screen, row, left
   clear-line-delimited screen, left, right
-  print screen, 120/x, 245/grey
+  delete-icon:character <- copy 120/x
+  print screen, delete-icon, 245/grey
   # save menu row so we can detect clicks to it later
   starting-row:address:number <- get-address *sandbox, starting-row-on-screen:offset
   *starting-row <- copy row
@@ -330,9 +331,11 @@ recipe render-screen screen:address:screen, sandbox-screen:address:screen, left:
     column <- copy left
     screen <- move-cursor screen, row, column
     # initial leader for each row: two spaces and a '.'
-    print screen, 32/space, 245/grey
-    print screen, 32/space, 245/grey
-    print screen, 46/full-stop, 245/grey
+    space:character <- copy 32/space
+    print screen, space, 245/grey
+    print screen, space, 245/grey
+    full-stop:character <- copy 46/period
+    print screen, full-stop, 245/grey
     column <- add left, 3
     {
       # print row
@@ -353,13 +356,13 @@ recipe render-screen screen:address:screen, sandbox-screen:address:screen, left:
       loop
     }
     # print final '.'
-    print screen, 46/full-stop, 245/grey
+    print screen, full-stop, 245/grey
     column <- add column, 1
     {
       # clear rest of current line
       line-done?:boolean <- greater-than column, right
       break-if line-done?
-      print screen, 32/space
+      print screen, space
       column <- add column, 1
       loop
     }