diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-09-17 14:53:00 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-09-17 14:53:00 -0700 |
commit | 897ae8c1855f830d8819759ea327d147f28a09bf (patch) | |
tree | 700b9f8e59c8054d952076fa924c7a6b5a30fd99 /045closure_name.cc | |
parent | 0f2781f8a28881084295663c3e608e5f6f159047 (diff) | |
download | mu-897ae8c1855f830d8819759ea327d147f28a09bf.tar.gz |
3394
Diffstat (limited to '045closure_name.cc')
-rw-r--r-- | 045closure_name.cc | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/045closure_name.cc b/045closure_name.cc index de44ba57..cf96d7c6 100644 --- a/045closure_name.cc +++ b/045closure_name.cc @@ -5,20 +5,20 @@ :(scenario closure) def main [ - default-space:&:@:location <- new location:type, 30 - 1:&:@:location/names:new-counter <- new-counter - 2:num/raw <- increment-counter 1:&:@:location/names:new-counter - 3:num/raw <- increment-counter 1:&:@:location/names:new-counter + default-space:space <- new location:type, 30 + 1:space/names:new-counter <- new-counter + 2:num/raw <- increment-counter 1:space/names:new-counter + 3:num/raw <- increment-counter 1:space/names:new-counter ] def new-counter [ - default-space:&:@:location <- new location:type, 30 + default-space:space <- new location:type, 30 x:num <- copy 23 y:num <- copy 3 # variable that will be incremented - return default-space:&:@:location + return default-space:space ] def increment-counter [ - default-space:&:@:location <- new location:type, 30 - 0:&:@:location/names:new-counter <- next-ingredient # outer space must be created by 'new-counter' above + default-space:space <- new location:type, 30 + 0:space/names:new-counter <- next-ingredient # outer space must be created by 'new-counter' above y:num/space:1 <- add y:num/space:1, 1 # increment y:num <- copy 234 # dummy return y:num/space:1 @@ -153,16 +153,16 @@ def new-scope [ new-default-space x:&:num <- new number:type *x:&:num <- copy 34 - return default-space:&:@:location + return default-space:space ] def use-scope [ local-scope - outer:&:@:location <- next-ingredient - 0:&:@:location/names:new-scope <- copy outer:&:@:location + outer:space <- next-ingredient + 0:space/names:new-scope <- copy outer:space return *x:&:num/space:1 ] def main [ - 1:&:@:location/raw <- new-scope - 2:num/raw <- use-scope 1:&:@:location/raw + 1:space/raw <- new-scope + 2:num/raw <- use-scope 1:space/raw ] +mem: storing 34 in location 2 |