mail to <srfi minus 47 at srfi dot schemers dot org>. See instructions here to subscribe to the list. You can access previous messages via the archive of the mailing list.
This SRFI has been superseded by SRFI-63, "Homogeneous and Heterogeneous Arrays".
array-set!argument order is different from the same-named procedure in SRFI-25. Type dispatch on the first argument to
array-set!could support both SRFIs simultaneously.
make-arrayarguments are different from the same-named procedure in SRFI-25. Type dispatch on the first argument to
make-arraycould support both SRFIs simultaneously.
(make-array proto bound1 bound2 ...) (make-shared-array array mapper bound1 bound2 ...) (array-set! array obj index1 index2 ...) (array-in-bounds? array index1 index2 ...) (array-ref array index1 index2 ...)
equal?originate from Alan Bawden's "array.scm". SRFI-47's
array-set!argument order is that of Bawden's package. SLIB adopted "array.scm" in 1993. This form of
array-set!has also been part of the SCM Scheme implementation since 1993.
array=?with an array-augmented version of R5RS
make-arrayseamlessly supports as many uniform array types as an implementation provides, defaulting to arrays built on vectors (and strings).
make-shared-arraycreates arrays which overlay a subsection of a given array; allowing reversed indexes;
array-dimensionsare compatible with Common-Lisp.
Implementations are required to define all of the prototype
procedures. Those which the platform supports will have
platform-dependent definitions; the others will be defined identically
to the next larger prototype implemented; defaulting to
vector if there are none. All implementations must
support the string array type using a string.
This arrangement has platforms which support uniform array types employing them, with less capable platforms using vectors; but all working compatibly.
#f) to an ar64 or ar32 array is an error.
#t if the obj is an array, and
#f if not.
array?. A disjoint array predicate can be written:
(define (strict-array? obj) (and (array? obj) (not (string? obj)) (not (vector? obj))))
`Equal?' recursively compares the contents of pairs, vectors, strings, and arrays, applying `eqv?' on other objects such as numbers and symbols. A rule of thumb is that objects are generally `equal?' if they print the same. `Equal?' may fail to terminate if its arguments are circular data structures.
(equal? 'a 'a) ==> #t (equal? '(a) '(a)) ==> #t (equal? '(a (b) c) '(a (b) c)) ==> #t (equal? "abc" "abc") ==> #t (equal? 2 2) ==> #t (equal? (make-vector 5 'a) (make-vector 5 'a)) ==> #t (equal? (make-array (Au32 4) 5 3) (make-array (Au32 4) 5 3)) ==> #t (equal? (lambda (x) x) (lambda (y) y)) ==> unspecified
Creates and returns an array of type prototype with dimensions k1, k2, ... and filled with elements from prototype. prototype must be an array, vector, or string. The implementation-dependent type of the returned array will be the same as the type of prototype. except if that would be a vector or string with more than one dimension, in which case some variety of array will be returned.
If the prototype has no elements, then the initial contents of the returned array are unspecified. Otherwise, the returned array will be filled with the element at the origin of prototype.
(make-array '#(foo) 2 3) => #2A((foo foo foo) (foo foo foo))
These functions return a prototypical uniform-array enclosing the optional argument (which must be of the correct type). If the uniform-array type is supported by the implementation, then it is returned; defaulting to the next larger precision type; resorting finally to vector.
make-shared-array can be used to create shared subarrays of other
arrays. The mapper is a function that translates coordinates in
the new array into coordinates in the old array. A mapper must be
linear, and its range must stay within the bounds of the old array, but
it can be otherwise arbitrary. A simple example:
(define fred (make-array '#(#f) 8 8)) (define freds-diagonal (make-shared-array fred (lambda (i) (list i i)) 8)) (array-set! freds-diagonal 'foo 3) (array-ref fred 3 3) => FOO (define freds-center (make-shared-array fred (lambda (i j) (list (+ 3 i) (+ 3 j))) 2 2)) (array-ref freds-center 0 0) => FOO
Returns the number of dimensions of obj. If obj is not an array, 0 is returned.
Returns a list of dimensions.
(array-dimensions (make-array '#() 3 5)) => (3 5)
#t if its arguments would be acceptable to
Returns the (index1, index2, ...) element of array.
Stores obj in the (index1, index2, ...) element of array. The value returned
array-set! is unspecified.
Copyright (C) Aubrey Jaffer (2003, 2004). All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.