e1 <- new.env()
f1 <- a~b+c
environment(f1) <- e1
f2 <- ~-NULL+1
(l1 <- list_rhs.formula(f1))
(l2 <- list_rhs.formula(f2))
(l <- c(l1,l2))
# \dontshow{
stopifnot(identical(c(unclass(l)), alist(b, c, NULL, 1)))
stopifnot(identical(sign(l), c(1L,1L,-1L,1L)))
stopifnot(identical(envir(l), rep(list(e1, globalenv()), each=2)))
# }
(l <- c(l2[1], l1[2], l1[1], l1[1], l2[2]))
sign(l)[3] <- -1L
# \dontshow{
stopifnot(identical(c(unclass(l)), alist(NULL, c, b, b, 1)))
stopifnot(identical(sign(l), c(-1L,1L,-1L,1L,1L)))
stopifnot(identical(envir(l), list(globalenv(), e1, e1, e1, globalenv())))
# }
Run the code above in your browser using DataLab