This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home.

Source for wiki AdvancedArraysCowan version 2

author

cowan

comment


    

ipnr

198.185.18.207

name

AdvancedArraysCowan

readonly

0

text

This is a continuation of ArraysCowan, put on a separate page for convenience.

== Advanced procedures ==

These procedures are mostly derived in function, and sometimes in name, from ISO/IEC 8485 and ISO 17351, which standardize basic and extended APL respectively.

`(array-collapse `''array''` `''j''`)`

Let ''k'' be the rank of ''array''.  This procedure returns an array of rank ''j'', which MUST be less than or equal to ''k'', whose components are arrays of rank ''k''-''j''.  The shape of the returned array is equal to the first ''j'' components of the shape of ''array'', and the shapes of its subarrays are equal to the remaining ''k''-''j'' components.

`(array-reshape `''shape''` `''array''`)`

Constructs and returns a new array of shape ''shape'' whose components in row-major order are the components of ''array'' in row-major order.

`(array-reverse `''array''` `''axis''`)`

Constructs and returns a new array with the same shape as ''array'', but whose elements on the specified ''axis'' are reversed.  ''Axis'' must be a non-negative integer less than the rank of ''array''.

`(array-reverse! `''array''` `''axis''`)`

Overwrites ''array'' with the value of `(array-reverse `''array''` `''axis''`)`, but without allocating storage.

`(array-transpose `''array''`)`

Returns an array with the same components as ''array'', but with the order of the axes reversed.

`(array-transpose! `''array''` `''axis''`)`

Overwrites ''array'' with the value of `(array-transpose`''array''`)`, but without allocating storage.

`(array-replicate `''array''` `''vector''` `''axis''`)`

`(array-expand array `''booleans''` `''axis''`)`

`(array-rotate ...)`

`(array-dyadic-transpose `''array1''` `''array2''`)`

`(array-take `''array''` `''subscripts''`)`

`(array-drop `''array''` `''subscripts''`)`

`(array-recursive-ref `''array''` `''subscript'' ...`)`

Apply `array-ref` to the ''array'' using the first ''i'' subscripts, where ''i'' is the rank of ''array''.  If there are more subscripts, the result MUST be an array. Apply `array-ref` to the result using the next ''j'' subscripts, where ''j'' is the rank of the result.  Repeat until there are no more subscripts, returning the last result.


== Higher-order procedures ==

These procedures are mostly derived in function, and sometimes in name, from ISO/IEC 8485 and ISO 17351, which standardize basic and extended APL respectively.

`(array-reduce `''proc''` `''array''` `''axis''`)`

Construct and return a new array whose rank is one less than the rank of ''array'', by combining all the elements along ''axis'' using ''proc'', which MUST be a two-argument procedure.  The order and number of invocations of ''proc'' is unspecified.  If there is only one such element, it is unchanged.

`(array-reduce-subarrays `''proc''` `''array''` `''axis''` `''n''`)`

Construct and return a new array with the same rank as the rank of ''array'', by combining all the groups of elements of length ''n'' along ''axis'' using ''proc'', which MUST be a two-argument procedure.  The order and number of invocations of ''proc'' is unspecified.  If there is only one such group of elements, it is unchanged.

`(array-scan `''proc''` `''array''` `''axis''`)`

Construct and return a new array whose shape is the same as the shape of ''array''.  Each element along ''axis'' is constructed by reducing (as if by `array-reduce`) successive prefixes of the elements of ''array'' along that axis.

`(array-outer-product `''proc''` `''array1''` `''array2''`)`

Construct and return a new array whose shape is the concatenation of the shapes of ''array1'' and ''array2''.  Each component of the new array is the result of applying ''proc'' to every element of ''array1'' and every element of ''array2'' in unspecified order.  The order and number of invocations of ''proc'' is unspecified.

`(array-inner-product `''proc1''` `''proc2''` `''array1''` `''array2''`)`

time

2010-09-20 04:13:18

version

2