aboutsummaryrefslogtreecommitdiff
path: root/algebraic-structs.functor.vector.base.scm
diff options
context:
space:
mode:
authorMasaya Tojo <masaya@tojo.tokyo>2024-06-09 05:13:44 +0900
committerMasaya Tojo <masaya@tojo.tokyo>2024-06-09 05:13:44 +0900
commit92eeab2815eae6cd9ef22530d2e50fe0a620ec46 (patch)
tree8bfdca868c360846829f7582e12ab77ce843b8eb /algebraic-structs.functor.vector.base.scm
Initial commit
Diffstat (limited to 'algebraic-structs.functor.vector.base.scm')
-rw-r--r--algebraic-structs.functor.vector.base.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/algebraic-structs.functor.vector.base.scm b/algebraic-structs.functor.vector.base.scm
new file mode 100644
index 0000000..2f44673
--- /dev/null
+++ b/algebraic-structs.functor.vector.base.scm
@@ -0,0 +1,10 @@
+(module (algebraic-structs functor vector base) (map)
+ (import (rename scheme (map list-map))
+ (only (chicken base) add1))
+
+ (define (map f v)
+ (let* ((len (vector-length v))
+ (new (make-vector len)))
+ (do ((i 0 (add1 i)))
+ ((= i len) new)
+ (vector-set! new i (vector-ref v i))))))