mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-07-02 23:50:47 +02:00
Identify scm_is_vector with scm_is_simple_vector
This patch fixes the bug (vector-ref #1@1(1 2 3) 1) => 2. * libguile/vectors.c: (scm_is_vector): just as scm_is_simple_vector. * libguile/filesys.c, libguile/random.c, libguile/stime.c, libguile/trees.c, libguile/validate.h: use scm_is_vector instead of scm_is_simple_vector. * libguile/sort.c - scm_restricted_vector_sort_x: use scm_array_handle_writable_elements instead of scm_vector_writable_elements, to work with non-vector rank-1 array objects. - scm_sort_x: check for scm_is_array instead of scm_is_vector. Rank check is in restricted_vector_sort_x. - scm_sort: ditto. - scm_stable_sort_x: like scm_restricted_vector_sort_x. - scm_stable_sort: like scm_sort. * test-suite/tests/arrays.test: fix header. * test-suite/tests/random.test: new coverage test covering random:normal-vector! * test-suite/Makefile.am: include random.test in make check.
This commit is contained in:
parent
413c715679
commit
70a63479ad
10 changed files with 104 additions and 48 deletions
|
@ -504,7 +504,7 @@ static void
|
|||
vector_scale_x (SCM v, double c)
|
||||
{
|
||||
size_t n;
|
||||
if (scm_is_simple_vector (v))
|
||||
if (scm_is_vector (v))
|
||||
{
|
||||
n = SCM_SIMPLE_VECTOR_LENGTH (v);
|
||||
while (n-- > 0)
|
||||
|
@ -532,7 +532,7 @@ vector_sum_squares (SCM v)
|
|||
{
|
||||
double x, sum = 0.0;
|
||||
size_t n;
|
||||
if (scm_is_simple_vector (v))
|
||||
if (scm_is_vector (v))
|
||||
{
|
||||
n = SCM_SIMPLE_VECTOR_LENGTH (v);
|
||||
while (n-- > 0)
|
||||
|
@ -626,7 +626,7 @@ SCM_DEFINE (scm_random_normal_vector_x, "random:normal-vector!", 1, 1, 0,
|
|||
scm_generalized_vector_get_handle (v, &handle);
|
||||
dim = scm_array_handle_dims (&handle);
|
||||
|
||||
if (scm_is_vector (v))
|
||||
if (handle.element_type == SCM_ARRAY_ELEMENT_TYPE_SCM)
|
||||
{
|
||||
SCM *elts = scm_array_handle_writable_elements (&handle);
|
||||
for (i = dim->lbnd; i <= dim->ubnd; i++, elts += dim->inc)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue