d1 <- list("1" = "one")
d2 <- list("2" = "two")
d3 <- list("3" = "three")
# c() 构建新列表:d1 保持原样
d_all <- c(d1, d2)
# 不会就地修改:需要给结果赋值
d_all <- c(d_all, d3)
# modifyList():以右边的为准
clash <- modifyList(d1, list("1" = "ONE"))
# 陷阱:c() 会保留两个键值对,而 [[ 找到的是第一个
doubled <- c(d1, list("1" = "ONE"))
first_value <- doubled[["1"]]
# first_value = one
str(d_all)
str(d1)
str(clash)
cat("length(doubled) =", length(doubled), "\n")
cat("first_value =", first_value, "\n")