make-vector(3scm)
π make-vector β allocate a new vector π
okay so bestie, welcome to make-vector(3scm), coming at you straight out of the Scheme Programmer's Manual β¨ this is literally the page where you learn to birth a fresh lil vector, no cap.
πΈ LIBRARY πΈ
import it from whichever flavour of scheme you're living in today, they all got you:
(import (rnrs)) ;R6RS
(import (rnrs base)) ;R6RS
(import (scheme r5rs)) ;R7RS
(import (scheme base)) ;R7RS
π¦ SYNOPSIS π¦
(make-vector k)
(make-vector k fill)
π DESCRIPTION π
So like, make-vector hands you back a newly allocated vector with k elements in it. that's the whole vibe. π
if you pass that second argument, fill, then every single element gets initialized to fill β icon level behaviour honestly.
if you don't pass a second argument? then the initial contents of each element is unspecified. not "empty", not "zero", unspecified. so don't go assuming things, ok? π
π IMPLEMENTATION NOTES π
ngl this is where it gets a lil real. implementations vary in how well they handle a large k argument β like, some slay, some do not.
vectors typically need approximately four or eight bytes per element, and a large k means the system can run out of memory. π and if that happens? some implementations will crash while others raise &implementation-restriction. so yeah, big k is giving risk.
β RETURN VALUES β
exactly one value: a freshly allocated vector. that's it, that's the tea. π«Ά
π EXAMPLES π
(make-vector 3 #f) => #(#f #f #f)
ate, no crumbs. π
π§ COMPATIBILITY π§
this procedure works the same everywhere apart from error handling. same energy, different error drama. π¦
π ERRORS π
this procedure can raise exceptions with the following condition types:
&assertion(R6RS) β the wrong number of arguments was passed OR an argument was outside its domain. you broke a rule, bestie.- 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. (yes, catastrophically. that's the actual word. π)
π₯ SEE ALSO π₯
make-list(3scm)vector(3scm)
π STANDARDS π
R4RS, IEEE Scheme, R5RS, R6RS, R7RS β she's certified everywhere, periodt. β¨
π HISTORY π
This procedure first appeared in R2RS. an OG fr fr. π
π 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/. π«Ά
ok that's the whole page, go forth and allocate responsibly π
mwah π β this was make-vector(3scm), dated 2023-07-22, from the scheme-manpages crew. catch you in the next manpage bestie! πΈβ¨
π¦ where this page comes from
- nixpkgs unstable: scheme-manpages 0-unstable-2024-02-11
- π the page's license: MIT
- Copyright (c) 2023 Gwen Weinholt
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms