From 898df17eebd6b021486f3b4b33a3e5345c23ddb3 Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Fri, 3 Nov 2023 16:59:19 +0900 Subject: [PATCH] Lipsticks Signed-off-by: yamacir-kit --- README.md | 6 +++--- VERSION | 2 +- basis/srfi-4.ss | 3 +-- include/meevax/kernel/homogeneous_vector.hpp | 19 +++++++++++++------ src/kernel/boot.cpp | 17 ++++++----------- 5 files changed, 24 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 2786ecf13..50d40476e 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ Procedures for each standard are provided by the following R7RS-style libraries: cmake -B build -DCMAKE_BUILD_TYPE=Release cd build make package -sudo apt install build/meevax_0.5.67_amd64.deb +sudo apt install build/meevax_0.5.68_amd64.deb ``` or @@ -123,9 +123,9 @@ sudo rm -rf /usr/local/share/meevax | Target Name | Description |-------------|------------- -| `all` | Build shared-library `libmeevax.0.5.67.so` and executable `meevax` +| `all` | Build shared-library `libmeevax.0.5.68.so` and executable `meevax` | `test` | Test executable `meevax` -| `package` | Generate debian package `meevax_0.5.67_amd64.deb` +| `package` | Generate debian package `meevax_0.5.68_amd64.deb` | `install` | Copy files into `/usr/local` directly ## Usage diff --git a/VERSION b/VERSION index eee274e68..cacbd7a5f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.67 +0.5.68 diff --git a/basis/srfi-4.ss b/basis/srfi-4.ss index 0fe6465ac..649d1222c 100644 --- a/basis/srfi-4.ss +++ b/basis/srfi-4.ss @@ -1,7 +1,6 @@ (define-library (srfi 4) (import (meevax vector homogeneous)) - (export - f32vector? make-f32vector f32vector f32vector-length f32vector-ref + (export f32vector? make-f32vector f32vector f32vector-length f32vector-ref f32vector-set! f32vector->list list->f32vector f64vector? make-f64vector f64vector f64vector-length f64vector-ref diff --git a/include/meevax/kernel/homogeneous_vector.hpp b/include/meevax/kernel/homogeneous_vector.hpp index f9a0e19d5..bca80268f 100644 --- a/include/meevax/kernel/homogeneous_vector.hpp +++ b/include/meevax/kernel/homogeneous_vector.hpp @@ -34,6 +34,7 @@ inline namespace kernel homogeneous_vector() = default; + // list->@vector explicit homogeneous_vector(object xs) : valarray(length(xs)) { @@ -45,29 +46,35 @@ inline namespace kernel }); } + // make-@vector explicit homogeneous_vector(std::size_t size, object const& x) : valarray(input_cast(x), size) {} + // @vector-copy explicit homogeneous_vector(homogeneous_vector const& v, std::size_t begin, std::size_t end) : valarray(v.valarray[std::slice(begin, begin < end ? end - begin : 0, 1)]) {} + // @vector-copy explicit homogeneous_vector(homogeneous_vector const& v, std::size_t begin = 0) : homogeneous_vector { v, begin, v.valarray.size() } {} + // @vector-append explicit homogeneous_vector(homogeneous_vector const& a, homogeneous_vector const& b) : valarray(a.valarray.size() + b.valarray.size()) { - valarray[std::slice(0, a.valarray.size(), 1)] = a.valarray; - valarray[std::slice(a.valarray.size(), b.valarray.size(), 1)] = b.valarray; + slice(0, a.valarray.size()) = a.valarray; + slice(b.valarray.size(), valarray.size()) = b.valarray; } + // string->u8vector explicit homogeneous_vector(T const* data, std::size_t size) : valarray(data, size) {} + // get-output-u8vector explicit homogeneous_vector(std::vector const& v) : valarray(v.data(), v.size()) {} @@ -145,10 +152,6 @@ inline namespace kernel return check(a.valarray == b.valarray); } - using f32vector = homogeneous_vector; - - using f64vector = homogeneous_vector; - using s8vector = homogeneous_vector; using s16vector = homogeneous_vector; @@ -164,6 +167,10 @@ inline namespace kernel using u32vector = homogeneous_vector; using u64vector = homogeneous_vector; + + using f32vector = homogeneous_vector; + + using f64vector = homogeneous_vector; } // namespace kernel } // namespace meevax diff --git a/src/kernel/boot.cpp b/src/kernel/boot.cpp index 04ca9573b..2fb1dbc2d 100644 --- a/src/kernel/boot.cpp +++ b/src/kernel/boot.cpp @@ -2038,7 +2038,7 @@ inline namespace kernel define("(meevax vector homogeneous)", [](library & library) { - #define DEFINE_HOMOGENEOUS_VECTOR(TAG) \ + #define DEFINE_VECTOR(TAG) \ library.define(#TAG "vector?", [](let const& xs) \ { \ return xs[0].is(); \ @@ -2170,16 +2170,11 @@ inline namespace kernel return make(xs[0]); \ }) - DEFINE_HOMOGENEOUS_VECTOR(f32); - DEFINE_HOMOGENEOUS_VECTOR(f64); - DEFINE_HOMOGENEOUS_VECTOR(s8); - DEFINE_HOMOGENEOUS_VECTOR(s16); - DEFINE_HOMOGENEOUS_VECTOR(s32); - DEFINE_HOMOGENEOUS_VECTOR(s64); - DEFINE_HOMOGENEOUS_VECTOR(u8); - DEFINE_HOMOGENEOUS_VECTOR(u16); - DEFINE_HOMOGENEOUS_VECTOR(u32); - DEFINE_HOMOGENEOUS_VECTOR(u64); + DEFINE_VECTOR(s8); DEFINE_VECTOR(s16); DEFINE_VECTOR(s32); DEFINE_VECTOR(s64); + DEFINE_VECTOR(u8); DEFINE_VECTOR(u16); DEFINE_VECTOR(u32); DEFINE_VECTOR(u64); + DEFINE_VECTOR(f32); DEFINE_VECTOR(f64); + + #undef DEFINE_VECTOR library.define("u8vector->string", [](let const& xs) {