aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2024-09-12 19:45:42 +0100
committerArun Isaac2024-09-12 19:46:23 +0100
commit5c794e855472d4c86cdffdc49776baca1a8f81aa (patch)
tree0dc07d10cf7108a5d5c5c896d5e5505c3ecb392e
parentbfcb8e7cf94529ab626d6d4ee544c6afeaff6ee5 (diff)
downloadravanan-5c794e855472d4c86cdffdc49776baca1a8f81aa.tar.gz
ravanan-5c794e855472d4c86cdffdc49776baca1a8f81aa.tar.lz
ravanan-5c794e855472d4c86cdffdc49776baca1a8f81aa.zip
vectors: Add vector-append-map.
* ravanan/vectors.scm (vector-append-map): New public function.
-rw-r--r--ravanan/vectors.scm12
1 files changed, 12 insertions, 0 deletions
diff --git a/ravanan/vectors.scm b/ravanan/vectors.scm
index 0b62abf..9c0dd49 100644
--- a/ravanan/vectors.scm
+++ b/ravanan/vectors.scm
@@ -25,6 +25,7 @@
vector-every
vector-fold))
#:export (vector-map->list
+ vector-append-map
vector-append-map->list
map->vector
vector-filter
@@ -49,6 +50,17 @@
first-vector
other-vectors)))
+(define (vector-append-map proc first-vector . other-vectors)
+ "Map @var{proc} over vectors and return a vector of the results appended
+together."
+ (apply vector-fold
+ (lambda (_ result . elements)
+ (vector-append result
+ (apply proc elements)))
+ (vector)
+ first-vector
+ other-vectors))
+
(define (vector-append-map->list proc first-vector . other-vectors)
"Map @var{proc} over vectors and return a list of the results appended
together."