diff options
author | Arun Isaac | 2024-09-13 03:01:08 +0100 |
---|---|---|
committer | Arun Isaac | 2024-09-13 03:03:01 +0100 |
commit | a2143a9868c6371e12f9f185b2e81b3ca36a176b (patch) | |
tree | 0e16271fba828a2d13c94920d52fa591227990c4 | |
parent | fc1004d6c41c57e5ed9cae5da105e44937722959 (diff) | |
download | ravanan-a2143a9868c6371e12f9f185b2e81b3ca36a176b.tar.gz ravanan-a2143a9868c6371e12f9f185b2e81b3ca36a176b.tar.lz ravanan-a2143a9868c6371e12f9f185b2e81b3ca36a176b.zip |
vectors: Add vector-filter-map.
* ravanan/work/vectors.scm (vector-filter-map): New public function.
-rw-r--r-- | ravanan/work/vectors.scm | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ravanan/work/vectors.scm b/ravanan/work/vectors.scm index 160ff3e..45c87cb 100644 --- a/ravanan/work/vectors.scm +++ b/ravanan/work/vectors.scm @@ -29,6 +29,7 @@ vector-append-map->list map->vector vector-filter + vector-filter-map vector-filter-map->list vector-remove vector-find) @@ -80,6 +81,11 @@ together." "Return a vector with elements from @var{vec} that pass @var{pred}." (list->vector (filter pred (vector->list vec)))) +(define (vector-filter-map proc vec) + "Map @var{proc} over @var{vec} and return a vector of the results that are not +@code{#f}." + (list->vector (filter-map proc (vector->list vec)))) + (define (vector-filter-map->list proc vec) "Map @var{proc} over @var{vec} and return a list of the results that are not @code{#f}." |