about summary refs log tree commit diff stats
path: root/counters.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-10-29 21:31:46 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-10-29 21:31:46 -0700
commit1ae2ff1c8c09a4a7ac2a518b4be2008626d482df (patch)
treec76833941d55df0aa41f520aff0893d5a45d8060 /counters.mu
parent39017bac428f554b84a15f4d6d7fa2a07eb7b16c (diff)
downloadmu-1ae2ff1c8c09a4a7ac2a518b4be2008626d482df.tar.gz
2324 - static dispatch works with arcane headers!
Diffstat (limited to 'counters.mu')
-rw-r--r--counters.mu15
1 files changed, 7 insertions, 8 deletions
diff --git a/counters.mu b/counters.mu
index be1f098a..816b6790 100644
--- a/counters.mu
+++ b/counters.mu
@@ -1,18 +1,17 @@
 # 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 n:number -> default-space:address:array:location [
+  default-space <- new location:type, 30
+  load-ingredients
 ]
 
-recipe increment-counter [
+recipe increment-counter outer:address:array:location/names:new-counter, x:number -> n:number/space:1 [
   local-scope
-  0:address:array:location/names:new-counter <- next-ingredient  # setup outer space; it *must* come from 'new-counter'
-  x:number <- next-ingredient
+  load-ingredients
+  0:address:array:location/names:new-counter <- copy outer  # setup outer space; it *must* come from 'new-counter'
   n:number/space:1 <- add n:number/space:1, x
-  reply n:number/space:1
+  reply n/space:1
 ]
 
 recipe main [