diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-06-19 16:34:11 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-06-19 16:34:11 -0700 |
commit | a91c1c2a28583262cc6052a5c3d9e713e9b4c0e0 (patch) | |
tree | eb9d9b38071275630e9533b2b02ddde048bae582 /counters.mu | |
parent | fc52705f4956df9a756b902b187f31799c1451a4 (diff) | |
download | mu-a91c1c2a28583262cc6052a5c3d9e713e9b4c0e0.tar.gz |
1599
Diffstat (limited to 'counters.mu')
-rw-r--r-- | counters.mu | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/counters.mu b/counters.mu index dab6850f..ba8c904f 100644 --- a/counters.mu +++ b/counters.mu @@ -1,7 +1,7 @@ # example program: maintain multiple counters with isolated lexical scopes # (spaces) -recipe init-counter [ +recipe new-counter [ default-space:address:array:location <- new location:type, 30:literal n:number <- next-ingredient reply default-space:address:array:location @@ -9,7 +9,7 @@ recipe init-counter [ recipe increment-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' + 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:number reply n:number/space:1 @@ -18,9 +18,9 @@ recipe increment-counter [ recipe main [ default-space:address:array:location <- new location:type, 30:literal # counter A - a:address:array:location <- init-counter 34:literal + a:address:array:location <- new-counter 34:literal # counter B - b:address:array:location <- init-counter 23:literal + b:address:array:location <- new-counter 23:literal # increment both by 2 but in different ways increment-counter a:address:array:location, 1:literal b-value:number <- increment-counter b:address:array:location, 2:literal |