about summary refs log tree commit diff stats
path: root/cpp/counters.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-05 19:47:34 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-05 19:47:34 -0700
commit4caa718f6b28871acc858cb9e5de7e0c4a7cba0f (patch)
tree7c146b9d0288bd8deb076a393f750ef1cd845044 /cpp/counters.mu
parent9b7e00e79b0b68d704005ab1e149be53c4154b20 (diff)
downloadmu-4caa718f6b28871acc858cb9e5de7e0c4a7cba0f.tar.gz
1272
Diffstat (limited to 'cpp/counters.mu')
-rw-r--r--cpp/counters.mu11
1 files changed, 7 insertions, 4 deletions
diff --git a/cpp/counters.mu b/cpp/counters.mu
index 8cc9a437..4662b833 100644
--- a/cpp/counters.mu
+++ b/cpp/counters.mu
@@ -1,19 +1,22 @@
+# example program: maintain multiple counters with isolated lexical scopes
+# (spaces)
+
 recipe init-counter [
-  default-space:address:space <- new location:type, 30:literal
+  default-space:address:array:location <- new location:type, 30:literal
   n:integer <- next-ingredient
   reply default-space:address:space
 ]
 
 recipe increment-counter [
-  default-space:address:space <- new location:type, 30:literal
-  0:address:space/names:init-counter <- next-ingredient  # setup outer space; it *must* come from 'init-counter'
+  default-space:address:array:location <- new location:type, 30:literal
+  0:address:array:location/names:init-counter <- next-ingredient  # setup outer space; it *must* come from 'init-counter'
   x:integer <- next-ingredient
   n:integer/space:1 <- add n:integer/space:1, x:integer
   reply n:integer/space:1
 ]
 
 recipe main [
-  default-space:address:space <- new location:type, 30:literal
+  default-space:address:array:location <- new location:type, 30:literal
   # counter A
   a:address:space <- init-counter 34:literal
   # counter B