(import (scheme base)) ;R7RS
Returns a newly allocated copy of the given obj if it is a list. Only the pairs
themselves are copied; the cars of the result are the same (in the sense of
eqv?(3scm)) as the cars of list. If obj is an improper list, so is the
result, and the final cdrs are the same in the sense of eqv?(3scm). An
obj which is not a list is returned unchanged.
(define a '(1 8 2 8)) ; a may be immutable
(define b (list-copy a))
(set-car! b 3) ; b is mutable
b => (3 8 2 8)
a => (1 8 2 8)
This procedure is unique to R6RS. An alternative is to write
(map values obj).
It is an error if the wrong number of arguments was passed or an argument was
outside its domain. It is an error if obj is a circular list.
Implementations may signal an error, extend the procedure's domain of
definition to include such arguments, or fail catastrophically.
This procedure is new in R7RS.