about summary refs log tree commit diff stats
path: root/chessboard.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 /chessboard.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 'chessboard.mu')
-rw-r--r--chessboard.mu3
1 files changed, 2 insertions, 1 deletions
diff --git a/chessboard.mu b/chessboard.mu
index c8c84eed..e5f894fa 100644
--- a/chessboard.mu
+++ b/chessboard.mu
@@ -149,6 +149,7 @@ recipe print-board screen:address:screen, board:address:array:address:array:char
   local-scope
   load-ingredients
   row:number <- copy 7  # start printing from the top of the board
+  space:character <- copy 32/space
   # print each row
   {
     done?:boolean <- lesser-than row, 0
@@ -166,7 +167,7 @@ recipe print-board screen:address:screen, board:address:array:address:array:char
       f:address:array:character <- index *board, col
       c:character <- index *f, row
       print screen, c
-      print screen, 32/space
+      print screen, space
       col <- add col, 1
       loop
     }