9.2 Arrays

The module Array contains procedures operating on arrays. Whenever an array access is indexed with an illegal key, an error exception is raised.

IsArray

{Array.is +X ?B}

tests whether X is an array.

NewArray

{Array.new +LowI +HighI InitX ?Array}

returns a new array with key range from LowI to HighI including both. All items are initialized to InitX.

Put

{Array.put +Array +I X}

sets the item of Array under key I to X.

Get

{Array.get +Array +I X}

returns the item of Array under key I.

exchange

{Array.exchange +Array +I OldVal NewVal}

returns the current value of Array under key I as item OldVal and updates the value of Array under key I to be NewVal.

low

{Array.low +Array ?LowI}

returns the lower bound of the key range of Array.

high

{Array.high +Array ?HighI}

returns the upper bound of the key range of Array.

clone

{Array.clone +A1 ?A2}

returns a new array with the same bounds and contents as A1.

toRecord

{Array.toRecord +L +A ?R}

returns a record with label L that contains as features the integers between {Array.low A} and {Array.high A} and with the corresponding fields.


Denys Duchier, Leif Kornstaedt and Christian Schulte
Version 1.4.0 (20080702)