list-copy(3scm)

πŸ“¦ version 0-unstable-2024-02, in nixpkgs unstable

🌸 NAME 🌸

okay so bestie, this is list-copy from the Scheme Programmer's Manual (3scm), and it is literally the β€œcopy a list” procedure. main character energy for list duplication, no cap. πŸ’…βœ¨


πŸ“š LIBRARY πŸ“š

(import (scheme base))              ;R7RS

✨ SYNOPSIS ✨

(list-copy obj)

πŸ’– DESCRIPTION πŸ’–

So list-copy returns a newly allocated copy of the given obj if it is a list. 🫢 Only the pairs themselves get copied β€” the cars of the result are the same in the eqv?(3scm) sense as the cars of the original list. If obj is an improper list, the result is improper too, and the final cdrs are the same in the eqv?(3scm) sense. And if obj is not a list? It comes back unchanged, bestie. periodt.

πŸŽ€ RETURN VALUES πŸŽ€

Returns a single value. One value, no extras, iconic behavior. ✨

🌈 EXAMPLES 🌈

(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)

πŸ¦‹ COMPATIBILITY πŸ¦‹

This procedure is unique to R6RS. An alternative is to write (map values obj). iykyk πŸ’œ

🚨 ERRORS 🚨

🚨 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. not the catastrophic fail, bestie 😭

πŸ‘€ SEE ALSO πŸ‘€

⭐ STANDARDS ⭐

R7RS. that's it. slay. πŸ‘‘

πŸ•°οΈ HISTORY πŸ•°οΈ

This procedure is new in R7RS. fresh out the R7RS oven πŸ”₯

πŸ‘‘ AUTHORS πŸ‘‘

This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://github.com/schemedoc/manpages/. The legends behind the docs 🫢

okay that's the whole list-copy(3scm) page, bestie β€” from the Scheme Programmer's Manual, dated 2023-08-13 πŸ«ΆπŸ’–βœ¨

πŸ“¦ where this page comes from