From b7fc9d3b5c4da25af0b919e65996b5dc0c3cf9f5 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 26 May 2017 23:50:50 -0700 Subject: 3879 --- html/065duplex_list.mu.html | 110 +++++++++++++++++++++----------------------- 1 file changed, 52 insertions(+), 58 deletions(-) (limited to 'html/065duplex_list.mu.html') diff --git a/html/065duplex_list.mu.html b/html/065duplex_list.mu.html index 55bb4707..8f0cf4a8 100644 --- a/html/065duplex_list.mu.html +++ b/html/065duplex_list.mu.html @@ -555,70 +555,64 @@ if ('onhashchange' in window) { 493 ] 494 ] 495 -496 # insert list beginning at 'new' after 'in' -497 def insert-range in:&:duplex-list:_elem, start:&:duplex-list:_elem/contained-in:in -> in:&:duplex-list:_elem [ +496 # insert list beginning at 'start' after 'in' +497 def splice in:&:duplex-list:_elem, start:&:duplex-list:_elem/contained-in:in -> in:&:duplex-list:_elem [ 498 local-scope 499 load-ingredients 500 return-unless in 501 return-unless start -502 end:&:duplex-list:_elem <- copy start -503 { -504 ¦ next:&:duplex-list:_elem <- next end/insert-range +502 end:&:duplex-list:_elem <- last start +503 next:&:duplex-list:_elem <- next in +504 { 505 ¦ break-unless next -506 ¦ end <- copy next -507 ¦ loop +506 ¦ *end <- put *end, next:offset, next +507 ¦ *next <- put *next, prev:offset, end 508 } -509 next:&:duplex-list:_elem <- next in -510 *end <- put *end, next:offset, next -511 { -512 ¦ break-unless next -513 ¦ *next <- put *next, prev:offset, end -514 } -515 *in <- put *in, next:offset, start -516 *start <- put *start, prev:offset, in -517 ] -518 -519 def append in:&:duplex-list:_elem, new:&:duplex-list:_elem/contained-in:in -> in:&:duplex-list:_elem [ -520 local-scope -521 load-ingredients -522 last:&:duplex-list:_elem <- last in -523 *last <- put *last, next:offset, new -524 return-unless new -525 *new <- put *new, prev:offset, last -526 ] -527 -528 def last in:&:duplex-list:_elem -> result:&:duplex-list:_elem [ -529 local-scope -530 load-ingredients -531 result <- copy in -532 { -533 ¦ next:&:duplex-list:_elem <- next result -534 ¦ break-unless next -535 ¦ result <- copy next -536 ¦ loop -537 } -538 ] -539 -540 # helper for debugging -541 def dump-from x:&:duplex-list:_elem [ -542 local-scope -543 load-ingredients -544 $print x, [: ] -545 { -546 ¦ break-unless x -547 ¦ c:_elem <- get *x, value:offset -548 ¦ $print c, [ ] -549 ¦ x <- next x -550 ¦ { -551 ¦ ¦ is-newline?:bool <- equal c, 10/newline -552 ¦ ¦ break-unless is-newline? -553 ¦ ¦ $print 10/newline -554 ¦ ¦ $print x, [: ] -555 ¦ } -556 ¦ loop -557 } -558 $print 10/newline, [---], 10/newline -559 ] +509 *in <- put *in, next:offset, start +510 *start <- put *start, prev:offset, in +511 ] +512 +513 def append in:&:duplex-list:_elem, new:&:duplex-list:_elem/contained-in:in -> in:&:duplex-list:_elem [ +514 local-scope +515 load-ingredients +516 last:&:duplex-list:_elem <- last in +517 *last <- put *last, next:offset, new +518 return-unless new +519 *new <- put *new, prev:offset, last +520 ] +521 +522 def last in:&:duplex-list:_elem -> result:&:duplex-list:_elem [ +523 local-scope +524 load-ingredients +525 result <- copy in +526 { +527 ¦ next:&:duplex-list:_elem <- next result +528 ¦ break-unless next +529 ¦ result <- copy next +530 ¦ loop +531 } +532 ] +533 +534 # helper for debugging +535 def dump-from x:&:duplex-list:_elem [ +536 local-scope +537 load-ingredients +538 $print x, [: ] +539 { +540 ¦ break-unless x +541 ¦ c:_elem <- get *x, value:offset +542 ¦ $print c, [ ] +543 ¦ x <- next x +544 ¦ { +545 ¦ ¦ is-newline?:bool <- equal c, 10/newline +546 ¦ ¦ break-unless is-newline? +547 ¦ ¦ $print 10/newline +548 ¦ ¦ $print x, [: ] +549 ¦ } +550 ¦ loop +551 } +552 $print 10/newline, [---], 10/newline +553 ] -- cgit 1.4.1-2-gfad0