Skip to content

Guideline Detection Problems in Nested Lists #94

@brodieG

Description

@brodieG

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)

screen shot 2016-11-17 at 11 20 38 am

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)

screen shot 2016-11-17 at 11 37 30 am

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions