From 0e4a335edc7d4e584924fd6b298156e45d2626c8 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 6 Sep 2015 16:35:46 -0700 Subject: 2175 --- html/counters.mu.html | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) (limited to 'html/counters.mu.html') diff --git a/html/counters.mu.html b/html/counters.mu.html index 9a02adca..45ca7a5d 100644 --- a/html/counters.mu.html +++ b/html/counters.mu.html @@ -13,11 +13,10 @@ pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; } body { font-family: monospace; color: #eeeeee; background-color: #080808; } * { font-size: 1.05em; } -.muRecipe { color: #ff8700; } +.Underlined { color: #c000c0; text-decoration: underline; } .Comment { color: #9090ff; } -.Constant { color: #00a0a0; } .Special { color: #ff6060; } -.muControl { color: #c0a020; } +.Identifier { color: #804000; } --> @@ -32,36 +31,36 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } # example program: maintain multiple counters with isolated lexical scopes # (spaces) -recipe new-counter [ - default-space:address:array:location <- new location:type, 30 - n:number <- next-ingredient - reply default-space +recipe new-counter [ + default-space:address:array:location <- new location:type, 30 + n:number <- next-ingredient + reply default-space ] -recipe increment-counter [ - local-scope - 0:address:array:location/names:new-counter <- next-ingredient # setup outer space; it *must* come from 'new-counter' - x:number <- next-ingredient - n:number/space:1 <- add n:number/space:1, x - reply n:number/space:1 +recipe increment-counter [ + local-scope + 0:address:array:location/names:new-counter <- next-ingredient # setup outer space; it *must* come from 'new-counter' + x:number <- next-ingredient + n:number/space:1 <- add n:number/space:1, x + reply n:number/space:1 ] -recipe main [ - local-scope +recipe main [ + local-scope # counter A - a:address:array:location <- new-counter 34 + a:address:array:location <- new-counter 34 # counter B - b:address:array:location <- new-counter 23 + b:address:array:location <- new-counter 23 # increment both by 2 but in different ways - increment-counter a, 1 - b-value:number <- increment-counter b, 2 - a-value:number <- increment-counter a, 1 + increment-counter a, 1 + b-value:number <- increment-counter b, 2 + a-value:number <- increment-counter a, 1 # check results - $print [Contents of counters -] + $print [Contents of counters +] # trailing space in next line is to help with syntax highlighting - $print [a: ], a-value, [ b: ], b-value, [ -] + $print [a: ], a-value, [ b: ], b-value, [ +] ] -- cgit 1.4.1-2-gfad0