diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-10-28 05:50:39 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-10-28 05:51:15 -0700 |
commit | 3b795875bc7ab25e5cfa02f74b1a4428af4c0ec4 (patch) | |
tree | 3b5ac4de7382ee1ff682fd9e94a813484bb3d6d9 /counters.mu | |
parent | 3eeea0a22d16e0fcd43bd33725c0b54639d0ad14 (diff) | |
download | mu-3b795875bc7ab25e5cfa02f74b1a4428af4c0ec4.tar.gz |
2295 - drop first-class recipes and continuations
Making life too complex at this time.
Diffstat (limited to 'counters.mu')
-rw-r--r-- | counters.mu | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/counters.mu b/counters.mu index 8a4da073..be1f098a 100644 --- a/counters.mu +++ b/counters.mu @@ -1,18 +1,18 @@ # example program: maintain multiple counters with isolated lexical scopes # (spaces) -recipe new-counter n:number -> default-space:address:array:location [ - default-space <- new location:type, 30 - load-ingredients - reply +recipe new-counter [ + default-space:address:array:location <- new location:type, 30 + n:number <- next-ingredient + reply default-space ] -recipe increment-counter outer:address:array:location/names:new-counter, x:number -> n:number/space:1 [ +recipe increment-counter [ local-scope - load-ingredients - 0:address:array:location/names:new-counter <- copy outer # setup outer space; it *must* come from 'new-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 - reply n/space:1 + reply n:number/space:1 ] recipe main [ |