vector-for-each(3scm)
π vector-for-each(3scm) π
okay bestie, welcome to the Scheme Programmer's Manual β this is the page for vector-for-each, and it's giving βtiny loop, big side-effect energyβ β¨
πΈ NAME πΈ
vector-for-each β loop over the elements of a vector π
π LIBRARY π
fr fr, import it from one of these:
(import (rnrs)) ;R6RS
(import (rnrs base)) ;R6RS
(import (scheme base)) ;R7RS
β¨ SYNOPSIS β¨
(vector-for-each proc vector1 vector2 ...)
π¦ DESCRIPTION π¦
So the vibe is: it applies proc element-wise to the elements of the vectors, for its side effects, in order from the first elements to the last. π«
R6RS β proc is always called in the same dynamic environment as vector-for-each itself. Also, the implementation must check the restrictions on proc to the extent performed by applying it as described. An implementation may check whether proc is an appropriate argument before applying it.
R7RS β if more than one vector is given and not all vectors have the same length, vector-for-each terminates when the shortest vector runs out. βοΈ
π RETURN VALUES π
R6RS β returns unspecified values.
R7RS β returns an unspecified value.
π EXAMPLES π
(vector-for-each
display
'#("Hello, " "world" ".0))
; prints: Hello, world.
π RATIONALE π
R7RS says that this procedure and a few others were added in order to round out the sequence operations. iconic behavior, honestly π
π«Ά COMPATIBILITY π«Ά
The R7RS variant of this procedure terminates early if the vectors are not the same length, but the R6RS variant requires that all the vectors are the same length. Additionally R7RS makes it an error to mutate any of the vectors.
π 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. In particular, the vectors should all have the same length andprocshould accept as many arguments as there are vectors.- R7RS β the assertions described above (except for the length requirement) are errors. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically. It is an error for
procto mutate any of the vectors.
bestie, βfail catastrophicallyβ is right there in the manual β do not test that vibe on purpose π
π SEE ALSO π
for-each(3scm)vector-map(3scm)
β STANDARDS β
R6RS, R7RS
π°οΈ HISTORY π°οΈ
This procedure first appeared in R6RS. It was later also added to R7RS.
π 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/.
π okay that's the whole page, bestie β vector-for-each(3scm) from the Scheme Programmer's Manual, dated 2023-01-23. stay slay, happy looping! π«Άβ¨
π¦ 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