Copy-on-modify Semantics

If we create a list.

x <- list(a = 1, b = 1)

And a function to modify the element “a” of the list.

f <- function(x) {
  x$a = 2
  invisible(x)
}