1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00
Commit graph

8 commits

Author SHA1 Message Date
Daniel Llorens
a5bb9da6ea New functions (array-for-each-cell, array-for-each-cell-in-order)
* libguile/array-map.c (scm_i_array_rebase, scm_array_for_each_cell):
  New functions. Export scm_array_for_each_cell() as
  (array-for-each-cell).

  (array-for-each-cell-in-order): Define additional export.

* libguile/array-map.h (scm_i_array_rebase, scm_array_for_each_cell):
  Add prototypes.

* doc/ref/api-compound.texi: New section 'Arrays as arrays of
  arrays'. Move the documentation for (array-from), (array-from*) and
  (array-amend!) in here. Add documentation for (array-for-each-cell).

* test-suite/tests/array-map.test: Renamed from
  test-suite/tests/ramap.test, fix module name. Add tests for
  (array-for-each-cell).

* test-suite/Makefile.am: Apply rename array-map.test -> ramap.test.

* doc/ref/api-compound.texi: Minor documentation fixes.
2016-11-18 12:03:30 +01:00
Daniel Llorens
00f81b6f31 Speed up for multi-arg cases of scm_ramap functions
This patch results in a 20%-40% speedup in the > 1 argument cases of
the following microbenchmarks:

(define A (make-shared-array #0(1) (const '()) #e1e7))
; 1, 2, 3 arguments.
(define a 0) ,time (array-for-each (lambda (b) (set! a (+ a b))) A)
(define a 0) ,time (array-for-each (lambda (b c) (set! a (+ a b c))) A A)
(define a 0) ,time (array-for-each (lambda (b c d) (set! a (+ a b c d))) A A A)

(define A (make-shared-array (make-array 1) (const '()) #e1e7))
(define B (make-shared-array #0(1) (const '()) #e1e7))
; 1, 2, 3 arguments.
,time (array-map! A + B)
,time (array-map! A + B B)
,time (array-map! A + B B B)

* libguile/array-map.c (scm_ramap): Note on cproc arguments.

  (rafill): Assume that dst's lbnd is 0.

  (racp): Assume that src's lbnd is 0.

  (ramap): Assume that ra0's lbnd is 0. When there're more than two
  arguments, compute the array handles before the loop. Allocate the arg
  list once and reuse it in the loop.

  (rafe): Do as in ramap(), when there's more than one argument.

  (AREF, ASET): Remove.
2016-11-18 12:03:30 +01:00
Daniel Llorens
0ebea8746b Remove deprecated array functions
* libguile/array-map.c (scm_array_fill_int, scm_array_fill_int,
    scm_ra_eqp, scm_ra_lessp scm_ra_leqp, scm_ra_grp, scm_ra_greqp,
    scm_ra_sum, scm_ra_difference, scm_ra_product, scm_ra_divide,
    scm_array_identity): Remove deprecated functions.

* libguile/array-map.h: Remove declaration of deprecated functions.

* libguile/generalized-vectors.h, libguile/generalized-vectors.c
  (scm_is_generalized_vector, scm_c_generalized_vector_length,
  scm_c_generalized_vector_ref, scm_c_generalized_vector_set_x): These
  functions were deprecated in 2.0.9. Remove.

* doc/ref/api-compound.texi: Remove uniform-array-read!,
  uniform-array-write from the manual. These procedures where removed in
  fc7bd367ab (2011-05-12).
2016-11-18 12:03:29 +01:00
Daniel Llorens
d09b201d59 Deprecate scm_array_fill_int()
* libguile/array-map.h, libgule/array-map.c: move scm_array_fill_int
  to the deprecated section.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2013-04-05 22:54:14 +02:00
Daniel Llorens
75a1b26c5d Deprecate dead code in array-map.c
* libguile/array-map.c, libguile/array-map.h: deprecate scm_ra_eqp,
  scm_ra_lessp, scm_ra_leqp, scm_ra_grp, scm_ra_greqp, scm_ra_sum,
  scm_ra_product, scm_ra_difference, scm_ra_divide, scm_array_identity.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2013-04-03 21:46:27 +02:00
Ludovic Courtès
10b9343f04 Change `scm_ramapc' prototype to avoid empty declarators (bug #23681).
* libguile/array-map.h (scm_ramapc): Change `cproc' to `void *' instead
  of using empty declarators.

* libguile/array-map.c (scm_ramapc): Adjust accordingly.
2011-02-13 14:47:33 +01:00
Andy Wingo
a587d6a973 more fixes to equal? for arrays
* 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.
2010-04-01 00:25:06 +02:00
Andy Wingo
5d1b3b2db9 rename ramap.[ch] to array-map.[ch]
* libguile/array-map.c:
* libguile/array-map.h: Rename from ramap.c and ramap.h.

* libguile.h:
* libguile/Makefile.am:
* libguile/eq.c:
* libguile/init.c:
* libguile/sort.c:
* libguile/unif.c:
* libguile/vectors.c: All referrers changed.
2009-07-19 14:53:03 +02:00
Renamed from libguile/ramap.h (Browse further)