A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/brodieG/diffobj/issues/94 below:

Guideline Detection Problems in Nested Lists · Issue #94 · brodieG/diffobj · GitHub

with:

rand_nested_list <- function(
  depth=1, max.depth=5, max.length=5, vec.size=32
) {
  res <- vector("list", sample(max.length, 1))
  for(i in seq_along(res)) {
    res[[i]] <- if(depth >= max.depth || runif(1) < .2) {
      sample(1:1000, vec.size)
    } else {
      Recall(depth + 1L, max.depth, max.length)
    }
  }
  res
}
mangle <- function(z)
  if(runif(1) < .4) {
    if(rand <- runif(1) < .5) z[-sample(length(z), sample(3, 1))]
    else {
      for(j in rev(sort(sample(length(z), min(3, length(z))))))
        z <- append(z, sample(1:1000, 1), after=j)
      z
    }
  } else z

These should not have guidelines shown:

set.seed(4)
x <- rand_nested_list(max.depth=3, max.length=3)
y <- rapply(x, how="list", mangle)
diffPrint(x, y, context=1)

A better example, why do we get guideline treatment on second to last, but not on last hunk:

set.seed(10)
x <- rand_nested_list(max.depth=3, max.length=3, vec.size=25)
y <- rapply(x, how="list", mangle)
diffPrint(x, y)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4