vector-copy(3scm)

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

πŸ’… vector-copy (3scm) β€” the Scheme Programmer's Manual cutie πŸ’…

okay bestie, welcome to the vector-copy(3scm) page from the Scheme Programmer's Manual β€” it’s giving β€œcopy that vector” and honestly? iconic. Let’s get into it. πŸ¦‹βœ¨


✨ NAME ✨

vector-copy β€” copy a vector πŸ’–


πŸ“š LIBRARY πŸ“š

(import (scheme base)) ;R7RS

yep, that’s the R7RS import, bestie. πŸŽ€


🌸 SYNOPSIS 🌸

(vector-copy vector)
(vector-copy vector start)
(vector-copy vector start end)

🫢 DESCRIPTION 🫢

Returns a newly allocated copy of the elements of the given vector between start and end. πŸ”₯

The elements of the new vector are the same β€” in the sense of eqv?(3scm) β€” as the elements of the old vector. no cap, that’s the whole vibe. πŸ’œ


πŸ‘‘ RETURN VALUES πŸ‘‘

Returns a single value: a new vector object. periodt. πŸ’…


πŸ“ EXAMPLES πŸ“

(define a #(1 8 2 8))      ; a may be immutable
(define b (vector-copy a)) ; b is mutable
(vector-set! b 0 3)
b => #(3 8 2 8)

(vector-copy b 1 3)  =>  #(8 2)

look at b thriving and mutable β€” we love to see it. πŸ˜­πŸ’–


🧚 COMPATIBILITY 🧚

There’s an equivalent procedure in SRFI-43. yep, the SRFI-43 girlies are covered too. 🌈


πŸ’€ ERRORS πŸ’€

It is an error if the wrong number of arguments was passed or an argument was outside its domain. 🚨

R7RS implementations may:

  • signal an error,
  • extend the procedure’s domain of definition to include such arguments,
  • or fail catastrophically.

that last one is not a vibe, bestie β€” proceed with caution. πŸ™ˆπŸ’€


πŸ” SEE ALSO πŸ”

vector-copy! (3scm) β€” go check that one too, iykyk. ✨


⭐ STANDARDS ⭐

R7RS, SRFI-43


πŸŽ€ HISTORY πŸŽ€

The first RnRS revision with this procedure is R7RS, which took it from SRFI-43. history lesson slay. πŸ’…πŸ“–


πŸ’œ 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/


xoxo, this vector-copy(3scm) page is from the Scheme Programmer's Manual and is dated 2022-04-10 β€” mwah πŸ’‹πŸ’–

πŸ“¦ where this page comes from