vector-fill!(3scm)
π vector-fill! β fill a vector, bestie
okay so picture this: it's vector-fill! from the Scheme Programmer's Manual (that's 3scm for the section, iykyk) and she is literally here to fill your vector with one single object. every slot. no cap.
π LIBRARY
so you gotta import her first, and she's chill about it β several vibes work:
(import (rnrs)) ;R6RS
(import (rnrs base)) ;R6RS
(import (scheme r5rs)) ;R7RS
(import (scheme base)) ;R7RS
pick your era, queen. both houses accept her π
β¨ SYNOPSIS β¨
(vector-fill! vector obj)
(vector-fill! vector obj start) ;R7RS
(vector-fill! vector obj start end) ;R7RS
look at those R7RS glow-ups. the extra args are a lewk.
π¦ DESCRIPTION
so the whole plot is: she stores obj in every element of vector. like, all of them. every single one. periodt. π
R7RS β okay so the R7RS girlies get to be picky: the operation is limited to the elements between start (inclusive) and end (exclusive). those two default to 0 and the length of vector. so if you don't pass them, it's the full vector again, no worries bestie π«Ά
πΈ RETURN VALUES
- R6RS β returns unspecified values. plural. mysterious. she's not telling.
- R7RS β returns an unspecified value. singular. equally mysterious. π
ngl, don't build your whole program on whatever comes back here. she's giving nothing and that's the point.
π EXAMPLES
here's the R7RS moment, as written:
;; This example is for R7RS
(define a (vector 1 2 3 4 5))
(vector-fill! a 'smash 2 4)
a => #(1 2 smash smash 5)
the way smash just ate indices 2 and 3 and left 1 2 and 5 untouched?? iconic. π₯ (that's start inclusive, end exclusive, exactly like we said π
)
π§ COMPATIBILITY
the R7RS variant of this procedure has extra arguments. that's it, that's the tea. β
π ERRORS
she can raise exceptions with these 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.
π fail catastrophically. she said it, not me. do not test her.
π SEE ALSO
make-vector(3scm)β the origin story, go read her too π¦
β STANDARDS
R4RS, R5RS, R6RS, R7RS β she's been in the game across four standards, main character energy fr fr π
π HISTORY
this procedure first appeared in R2RS. ancient. legendary. the blueprint. π
π«Ά 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/ β¨
kisses and unspecified values, bestie π β page dated 2023-01-26, from the 3scm set, vector-fill!(3scm) forever and always πΈ
π¦ 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