diff options
Diffstat (limited to '074list.mu')
-rw-r--r-- | 074list.mu | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/074list.mu b/074list.mu index 089533e0..833a52cb 100644 --- a/074list.mu +++ b/074list.mu @@ -5,24 +5,24 @@ container list:_elem [ value:_elem - next:address:shared:list:_elem + next:address:list:_elem ] -def push x:_elem, in:address:shared:list:_elem -> in:address:shared:list:_elem [ +def push x:_elem, in:address:list:_elem -> in:address:list:_elem [ local-scope load-ingredients - result:address:shared:list:_elem <- new {(list _elem): type} + result:address:list:_elem <- new {(list _elem): type} *result <- merge x, in return result # needed explicitly because we need to replace 'in' with 'result' ] -def first in:address:shared:list:_elem -> result:_elem [ +def first in:address:list:_elem -> result:_elem [ local-scope load-ingredients result <- get *in, value:offset ] -def rest in:address:shared:list:_elem -> result:address:shared:list:_elem/contained-in:in [ +def rest in:address:list:_elem -> result:address:list:_elem/contained-in:in [ local-scope load-ingredients result <- get *in, next:offset @@ -30,15 +30,15 @@ def rest in:address:shared:list:_elem -> result:address:shared:list:_elem/contai scenario list-handling [ run [ - 1:address:shared:list:number <- push 3, 0 - 1:address:shared:list:number <- push 4, 1:address:shared:list:number - 1:address:shared:list:number <- push 5, 1:address:shared:list:number - 2:number <- first 1:address:shared:list:number - 1:address:shared:list:number <- rest 1:address:shared:list:number - 3:number <- first 1:address:shared:list:number - 1:address:shared:list:number <- rest 1:address:shared:list:number - 4:number <- first 1:address:shared:list:number - 1:address:shared:list:number <- rest 1:address:shared:list:number + 1:address:list:number <- push 3, 0 + 1:address:list:number <- push 4, 1:address:list:number + 1:address:list:number <- push 5, 1:address:list:number + 2:number <- first 1:address:list:number + 1:address:list:number <- rest 1:address:list:number + 3:number <- first 1:address:list:number + 1:address:list:number <- rest 1:address:list:number + 4:number <- first 1:address:list:number + 1:address:list:number <- rest 1:address:list:number ] memory-should-contain [ 1 <- 0 # empty to empty, dust to dust.. @@ -48,24 +48,24 @@ scenario list-handling [ ] ] -def to-text in:address:shared:list:_elem -> result:address:shared:array:character [ +def to-text in:address:list:_elem -> result:address:array:character [ local-scope load-ingredients - buf:address:shared:buffer <- new-buffer 80 + buf:address:buffer <- new-buffer 80 buf <- to-buffer in, buf result <- buffer-to-array buf ] # variant of 'to-text' which stops printing after a few elements (and so is robust to cycles) -def to-text-line in:address:shared:list:_elem -> result:address:shared:array:character [ +def to-text-line in:address:list:_elem -> result:address:array:character [ local-scope load-ingredients - buf:address:shared:buffer <- new-buffer 80 + buf:address:buffer <- new-buffer 80 buf <- to-buffer in, buf, 6 # max elements to display result <- buffer-to-array buf ] -def to-buffer in:address:shared:list:_elem, buf:address:shared:buffer -> buf:address:shared:buffer [ +def to-buffer in:address:list:_elem, buf:address:buffer -> buf:address:buffer [ local-scope load-ingredients { @@ -77,7 +77,7 @@ def to-buffer in:address:shared:list:_elem, buf:address:shared:buffer -> buf:add val:_elem <- get *in, value:offset buf <- append buf, val # now prepare next - next:address:shared:list:_elem <- rest in + next:address:list:_elem <- rest in nextn:number <- copy next return-unless next buf <- append buf, [ -> ] |