* libguile/array-map.c: new function rafill, like scm_array_fill_int,
but factors GVSET out of the loop. Use it in scm_array_fill_x instead of
scm_array_fill_int.
* test-suite/tests/arrays.test: add test for array-fill! with stride != 1.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* libguile/array-handle.c (scm_array_handle_pos_1):
(scm_array_handle_pos_2): New functions.
* libguile/generalized-arrays.c (scm_c_array_ref_1, scm_c_array_ref_2):
(scm_c_array_set_1_x, scm_c_array_set_2_x): New functions.
(scm_i_array_ref, scm_i_array_set_x): New subr bindings for array-ref
and array-set! that avoid consing for arrays of rank 1 or 2.
* test-suite/tests/arrays.test ("array-set!"): Fix expected exception
for wrong number of indices.
Fixes <http://bugs.gnu.org/12465>.
Reported by Daniel Llorens <daniel.llorens@bluewin.ch>.
* libguile/generalized-vectors.c (scm_generalized_vector_to_list): Fix
initial value of POS; pass the `h.base + pos', not just `pos' as the
`vref' argument.
* test-suite/tests/arrays.test ("array->list")["http://bugs.gnu.org/12465
- ok", "http://bugs.gnu.org/12465 - bad]: New tests.
("generalized-vector->list"): New test prefix.
* libguile/generalized-vectors.c (scm_c_generalized_vector_ref):
(scm_c_generalized_vector_set_x): Fix for the case in which base was
not 1, lbnd was not 0, or inc was not 1.
* test-suite/tests/arrays.test (array): Add a test. Thanks to Daniel
Llorens for the report.
* libguile/array-map.c (array_compare, scm_array_equal_p): Rewrite as
something that operates on the generic array handle infrastructure.
Based on array->list.
(scm_i_array_equal_p): Change the docs, as array-equal? is now the same
as equal?, except that it typechecks its args.
* doc/ref/api-compound.texi (Array Procedures): Update array-equal?
docs.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_raequal): Deprecate.
* libguile/bytevectors.c (scm_bytevector_eq_p): Bugfix: bytevectors are
bytevector=? only if their element type is the same.
* libguile/eq.c (scm_equal_p): Only dispatch to scm_array_equal_p if
both args are arrays (generically).
* test-suite/tests/arrays.test ("equal?"): Add some more tests.
OK let's try again. While the thanks go to Daniel Llorens del Río for
the tip, the blame continues going to me :)
* test-suite/Makefile.am:
* test-suite/tests/arrays.test: Add a test.
* libguile/array-map.c (raeql): Handle a few 0-dimensional cases. If the
shapes of the arrays don't match, just return #f instead of raising
an error.
* libguile/eq.c (scm_equal_p): Only call scm_array_equal_p if both
arguments are generalized arrays; otherwise they are not equal. Thanks
to Daniel Llorens del Río for the tip.
* test-suite/Makefile.am:
* test-suite/tests/arrays.test: Add a test.