diff options
Diffstat (limited to '062array.mu')
-rw-r--r-- | 062array.mu | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/062array.mu b/062array.mu index dff9d319..c54020c0 100644 --- a/062array.mu +++ b/062array.mu @@ -1,7 +1,7 @@ scenario array-from-args [ run [ 1:address:array:location <- new-array 0, 1, 2 - 2:array:location <- copy 1:address:array:location/lookup + 2:array:location <- copy *1:address:array:location ] memory-should-contain [ 2 <- 3 # array length @@ -18,23 +18,23 @@ recipe new-array [ { # while read curr-value curr-value:location, exists?:boolean <- next-ingredient - break-unless exists?:boolean - capacity:number <- add capacity:number, 1 + break-unless exists? + capacity <- add capacity, 1 loop } - result:address:array:location <- new location:type, capacity:number + result:address:array:location <- new location:type, capacity rewind-ingredients i:number <- copy 0 { # while read curr-value - done?:boolean <- greater-or-equal i:number, capacity:number - break-if done?:boolean + done?:boolean <- greater-or-equal i, capacity + break-if done? curr-value:location, exists?:boolean <- next-ingredient - assert exists?:boolean, [error in rewinding ingredients to new-array] - tmp:address:location <- index-address result:address:array:location/lookup, i:number - tmp:address:location/lookup <- copy curr-value:location - i:number <- add i:number, 1 + assert exists?, [error in rewinding ingredients to new-array] + tmp:address:location <- index-address *result, i + *tmp <- copy curr-value + i <- add i, 1 loop } - reply result:address:array:location + reply result ] |