bytevector-copy(3scm)
π NAME π
bytevector-copy β bestie, it copies a bytevector, that's literally it
So this page lives in the Scheme Programmer's Manual (iconic company, no notes), and it's here to walk you through the one job this procedure has: duplicating bytes. Slay.
πΈ LIBRARY πΈ
ok so here's where you grab it from β pick your fave, they all work:
(import (rnrs)) ;R6RS
(import (rnrs bytevectors)) ;R6RS
(import (scheme base)) ;R7RS
β¨ SYNOPSIS β¨
(bytevector-copy bytevector)
(bytevector-copy bytevector start) ;R7RS
(bytevector-copy bytevector start end) ;R7RS
π¦ DESCRIPTION π¦
It hands you back a freshly allocated bytevector π filled with the bytes from bytevector that live between start (inclusive, she's invited) and end (exclusive, she's not). Classic half-open interval behaviour, we love to see it.
And if you're feeling lazy (valid), the defaults got you:
startdefaults to0enddefaults to the length of the input
π«Ά RETURN VALUES π«Ά
You get a bytevector back, and its length is end - start. Math! But make it bytes. π
π₯ EXAMPLES π₯
(define a #u8(1 2 3 4 5))
(bytevector-copy a 2 4))
=> #u8(3 4)
Look at her go. Grabbed index 2 and 3, dipped before 4. Main character energy fr fr.
π COMPATIBILITY π
Heads up bestie: the R6RS version of this procedure only has the first argument. So if you're passing start or end around in R6RS land, that's not gonna fly. π«
π ERRORS π
Yes, it can raise exceptions with the following condition types:
&assertion(R6RS) β the wrong number of arguments was passed, or an argument was outside its domain.- R7RS β the assertions described above are errors. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically. π Not "fail catastrophically" as a lil joke either β that's the actual wording. Stay safe out there.
π SEE ALSO π
bytevector-copy!(3scm) β the destructive sibling, go say hi π
π STANDARDS π
R6RS, R7RS β certified, both of them, no cap β
π§ AUTHORS π§
This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More info lives at https://github.com/schemedoc/manpages/ β go check it out π
and that's the whole page, bestie!! brought to you by the scheme-manpages source, dated 2021-02-20, from bytevector-copy(3scm) β mwah πβ¨π
π¦ where this page comes from
- nixpkgs unstable: scheme-manpages 0-unstable-2024-02-11
- π the page's license: MIT
- Copyright (c) 2021 Gwen Weinholt
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms