Uniform Arrays and vectors are arrays whose elements are all of the same type. Uniform vectors occupy less storage than conventional vectors. Uniform Array procedures also work on vectors, uniform-vectors, bit-vectors, and strings.

SLIB now supports uniform arrys. The primary array creation procedure
is `make-array`

, detailed in See Arrays.

Unshared uniform character 0-based arrays of rank 1 (dimension) are equivalent to (and can't be distinguished from) strings.

(make-array "" 3) ⇒ "$q2"

Unshared uniform boolean 0-based arrays of rank 1 (dimension) are equivalent to (and can't be distinguished from) bit-vectors.

(make-array '#1at() 3) ⇒ #*000 == #1At(#f #f #f) ⇒ #*000

`prototype` arguments in the following procedures are interpreted
according to the table:

prototype type display prefix () conventional vector #A +64i complex (double precision) #A:floC64b 64.0 double (double precision) #A:floR64b 32.0 float (single precision) #A:floR32b 32 unsigned integer (32-bit) #A:fixN32b -32 signed integer (32-bit) #A:fixZ32b -16 signed integer (16-bit) #A:fixZ16b #\a char (string) #A:char #t boolean (bit-vector) #A:bool

Other uniform vectors are written in a form similar to that of general
arrays, except that one or more modifying characters are put between the
#\A character and the contents list. For example, `'#1A:fixZ32b(3 5 9)`

returns a uniform vector of signed integers.

— Function: **array?**` obj prototype`

Returns

`#t`

if theobjis an array of type corresponding toprototype, and`#f`

if not.

— Function: **array-prototype**` array`

Returns an object that would produce an array of the same type as

array, if used as theprototypefor`list->uniform-array`

.

— Function: **list->uniform-array**` rank prot lst`

Returns a uniform array of the type indicated by prototype

protwith elements the same as those oflst. Elements must be of the appropriate type, no coercions are done.In, for example, the case of a rank-2 array,

lstmust be a list of lists, all of the same length. The length oflstwill be the first dimension of the result array, and the length of each element the second dimension.If

rankis zero,lst, which need not be a list, is the single element of the returned array.

— Function: **uniform-array-read!**` ura`

— Function:**uniform-array-read!**` ura port`

— Function:

Attempts to read all elements of

ura, in lexicographic order, as binary objects fromport. If an end of file is encountered during uniform-array-read! the objects up to that point only are put intoura(starting at the beginning) and the remainder of the array is unchanged.

`uniform-array-read!`

returns the number of objects read.portmay be omitted, in which case it defaults to the value returned by`(current-input-port)`

.

— Function: **uniform-array-write**` ura`

— Function:**uniform-array-write**` ura port`

— Function:

Writes all elements of

uraas binary objects toport. The number of of objects actually written is returned.portmay be omitted, in which case it defaults to the value returned by`(current-output-port)`

.

— Function: **logaref**` array index1 index2 ...`

If an

indexis provided for each dimension ofarrayreturns theindex1,index2, ...'th element ofarray. If one moreindexis provided, then the last index specifies bit position of the twos-complement representation of the array element indexed by the otherindexs returning`#t`

if the bit is 1, and`#f`

if 0. It is an error if this element is not an exact integer.(logaref '#(#b1101 #b0010) 0) ⇒ #b1101 (logaref '#(#b1101 #b0010) 0 1) ⇒ #f (logaref '#2((#b1101 #b0010)) 0 0) ⇒ #b1101

— Function: **logaset!**` array val index1 index2 ...`

If an

indexis provided for each dimension ofarraysets theindex1,index2, ...'th element ofarraytoval. If one moreindexis provided, then the last index specifies bit position of the twos-complement representation of an exact integer array element, setting the bit to 1 ifvalis`#t`

and to 0 ifvalis`#f`

. In this case it is an error if the array element is not an exact integer or ifvalis not boolean.