list-copy -- r7rs Definition procedure;
Procedure variants:
((null) -> (null))
((list-not-circular) -> (list-not-circular))
list-not-circular;list-not-circular;((list-circular) -> (exception))
list-circular;exception;(((a any)) -> ((a any)))
scheme:base -- (scheme base);scheme -- (scheme);(list-copy obj)Returns a newly allocated copy of the given
objif it is a list. Only the pairs themselves are copied; the cars of the result are the same (in the sense ofeqv?) as the cars oflist. Ifobjis an improper list, so is the result, and the final cdrs are the same in the sense ofeqv?. Anobjwhich is not a list is returned unchanged. It is an error ifobjis a circular list.(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)
The text herein was sourced and adapted as described in the "R7RS attribution of various text snippets" appendix.