(require 'array) or (require 'srfi-63)
Note: Arrays are not disjoint from other Scheme types.
Vectors and possibly strings also satisfy array?.
A disjoint array predicate can be written:
(define (strict-array? obj)
(and (array? obj) (not (string? obj)) (not (vector? obj))))
Returns
#tif obj1 and obj2 have the same rank and dimensions and the corresponding elements of obj1 and obj2 areequal?.
equal?recursively compares the contents of pairs, vectors, strings, and arrays, applyingeqv?on other objects such as numbers and symbols. A rule of thumb is that objects are generallyequal?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 (A:fixN32b 4) 5 3) (make-array (A:fixN32b 4) 5 3)) ⇒ #t (equal? (make-array '#(foo) 3 3) (make-array '#(foo) 3 3)) ⇒ #t (equal? (lambda (x) x) (lambda (y) y)) ⇒ unspecified
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)
Creates and returns an array of type prototype with dimensions k1, ... 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 rank not equal to one, 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-shared-arraycan 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
list must be a rank-nested list consisting of all the elements, in row-major order, of the array to be created.
list->arrayreturns an array of rank rank and type proto consisting of all the elements, in row-major order, of list. When rank is 0, list is the lone array element; not necessarily a list.(list->array 2 '#() '((1 2) (3 4))) ⇒ #2A((1 2) (3 4)) (list->array 0 '#() 3) ⇒ #0A 3
Returns a rank-nested list consisting of all the elements, in row-major order, of array. In the case of a rank-0 array,
array->listreturns the single element.(array->list #2A((ho ho ho) (ho oh oh))) ⇒ ((ho ho ho) (ho oh oh)) (array->list #0A ho) ⇒ ho
vect must be a vector of length equal to the product of exact nonnegative integers dim1, ....
vector->arrayreturns an array of type proto consisting of all the elements, in row-major order, of vect. In the case of a rank-0 array, vect has a single element.(vector->array #(1 2 3 4) #() 2 2) ⇒ #2A((1 2) (3 4)) (vector->array '#(3) '#()) ⇒ #0A 3
Returns a new vector consisting of all the elements of array in row-major order.
(array->vector #2A ((1 2)( 3 4))) ⇒ #(1 2 3 4) (array->vector #0A ho) ⇒ #(ho)
Returns
#tif its arguments would be acceptable toarray-ref.
Stores obj in the (k1, ...) element of array. The value returned by
array-set!is unspecified.
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.
Returns an inexact 128.bit flonum complex uniform-array prototype.
Returns an inexact 64.bit flonum complex uniform-array prototype.
Returns an inexact 32.bit flonum complex uniform-array prototype.
Returns an inexact 16.bit flonum complex uniform-array prototype.
Returns an inexact 128.bit flonum real uniform-array prototype.
Returns an inexact 64.bit flonum real uniform-array prototype.
Returns an inexact 32.bit flonum real uniform-array prototype.
Returns an inexact 16.bit flonum real uniform-array prototype.
Returns an exact 128.bit decimal flonum rational uniform-array prototype.
Returns an exact 64.bit decimal flonum rational uniform-array prototype.
Returns an exact 32.bit decimal flonum rational uniform-array prototype.
Returns an exact binary fixnum uniform-array prototype with at least 64 bits of precision.
Returns an exact binary fixnum uniform-array prototype with at least 32 bits of precision.
Returns an exact binary fixnum uniform-array prototype with at least 16 bits of precision.
Returns an exact binary fixnum uniform-array prototype with at least 8 bits of precision.
Returns an exact non-negative binary fixnum uniform-array prototype with at least 64 bits of precision.
Returns an exact non-negative binary fixnum uniform-array prototype with at least 32 bits of precision.
Returns an exact non-negative binary fixnum uniform-array prototype with at least 16 bits of precision.