diff --git a/lib/pure/asyncfutures.nim b/lib/pure/asyncfutures.nim index 5675f5399..ea7a798fc 100644 --- a/lib/pure/asyncfutures.nim +++ b/lib/pure/asyncfutures.nim @@ -217,16 +217,6 @@ proc `callback=`*[T](future: Future[T], ## If future has already completed then ``cb`` will be called immediately. future.callback = proc () = cb(future) -proc diff[T](a, b: seq[T]; firstB, lastB: int): int = - ## Iterates through both sequences until the items do not match, - ## returns the remainder of `b[firstB..lastB]` after the last item that does not match - ## together with the index of the last match. - result = firstB - for i in 0.. 0 and e > i+1: + if result[last] != entries[e]: + newBlock = false + break + dec e + dec last + + if newBlock: + for j in i+1 ..< reRaiseEnd: result.add entries[j] + i = reRaiseEnd+1 continue