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-28 05:40:27 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-10-28 05:40:27 -0700
commit3eeea0a22d16e0fcd43bd33725c0b54639d0ad14 (patch)
tree79d7b11bbd47d3a8c2e5d32d2f5b5ccf1310d0f9 /counters.mu
parent6808ff7d6df42aa8a8abe63041254b40b76ba8db (diff)
downloadmu-3eeea0a22d16e0fcd43bd33725c0b54639d0ad14.tar.gz
2294
Bah, sick of CALL and continuations.
Diffstat (limited to 'counters.mu')
-rw-r--r--counters.mu16
1 files changed, 8 insertions, 8 deletions
diff --git a/counters.mu b/counters.mu
index be1f098a..8a4da073 100644
--- a/counters.mu
+++ b/counters.mu
@@ -1,18 +1,18 @@
 # 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
+  reply
 ]
 
-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 [