User Tools


This shows you the differences between two versions of the page.

Link to this comparison view

cl:types:array [2017/04/28 10:10] (current)
Line 1: Line 1:
 +====== System Class ARRAY ======
 +====Class Precedence List====
 +**array**, **[[CL:​Types:​t]]**
 +An //​[[CL:​Glossary:​array]]//​ contains //​[[CL:​Glossary:​object|objects]]//​ arranged according to a Cartesian coordinate system. An //​[[CL:​Glossary:​array]]//​ provides mappings from a set of //​[[CL:​Glossary:​fixnum|fixnums]]//​ ''​{i<​sub>​0</​sub>,​i<​sub>​1</​sub>,​...,​i<​sub>​r-1</​sub>​}''​ to corresponding //​[[CL:​Glossary:​element|elements]]//​ of the //​[[CL:​Glossary:​array]]//,​ where ''​0 ≤ i<​sub>​j</​sub>​ < d<​sub>​j</​sub>'',​ ''​r''​ is the rank of the array, and ''​d<​sub>​j</​sub>''​ is the size of //​[[CL:​Glossary:​dimension]]//​ ''​j''​ of the array.
 +When an //​[[CL:​Glossary:​array]]//​ is created, the program requesting its creation may declare that all //​[[CL:​Glossary:​element|elements]]//​ are of a particular //​[[CL:​Glossary:​type]]//,​ called the //​[[CL:​Glossary:​expressed array element type]]//. The implementation is permitted to //​[[CL:​Glossary:​upgrade]]//​ this type in order to produce the //​[[CL:​Glossary:​actual array element type]]//, which is the //​[[CL:​Glossary:​element type]]// for the //​[[CL:​Glossary:​array]]//​ is actually //​[[CL:​Glossary:​specialized]]//​. See the //​[[CL:​Glossary:​function]]//​ **[[CL:​Functions:​upgraded-array-element-type]]**.
 +====Compound Type Specifier Kind====
 +====Compound Type Specifier Syntax====
 +  * //**array** //​[{element-type | **[[CL:​Types:​wildcard|*]]**} [dimension-spec]]////​
 +dimension-spec := rank | **[[CL:​Types:​wildcard|*]]** | (//​{dimension//​ | **[[CL:​Types:​wildcard|*]]**}''​*''​)
 +====Compound Type Specifier Arguments====
 +  * //​dimension//​ - a //​[[CL:​Glossary:​valid array dimension]]//​.
 +  * //​element-type//​ - a //​[[CL:​Glossary:​type specifier]]//​.
 +  * //rank// - a non-negative //​[[CL:​Glossary:​fixnum]]//​.
 +====Compound Type Specifier Description====
 +This denotes the set of //​[[CL:​Glossary:​array|arrays]]//​ whose //​[[CL:​Glossary:​element type]]//, //​[[CL:​Glossary:​rank]]//,​ and //​[[CL:​Glossary:​dimension|dimensions]]//​ match any given //​element-type//,​ //rank//, and //​dimensions//​. Specifically:​
 +If //​element-type//​ is the //​[[CL:​Glossary:​symbol]]//​ **[[CL:​Types:​wildcard|*]]**,​ //​[[CL:​Glossary:​array|arrays]]//​ are not excluded on the basis of their //​[[CL:​Glossary:​element type]]//. Otherwise, only those //arrays// are included whose //​[[CL:​Glossary:​actual array element type]]// is the result of //​[[CL:​Glossary:​upgrade|upgrading]]//​ //​element-type//;​ see section {\secref\ArrayUpgrading}.
 +If the //​dimension-spec//​ is a //rank//, the set includes only those //arrays// having that //​[[CL:​Glossary:​rank]]//​. If the //​dimension-spec//​ is a //​[[CL:​Glossary:​list]]//​ of //​dimensions//,​ the set includes only those //arrays// having a //​[[CL:​Glossary:​rank]]//​ given by the //​[[CL:​Glossary:​length]]//​ of the //​dimensions//,​ and having the indicated //​dimensions//;​ in this case, **[[CL:​Types:​wildcard|*]]** matches any value for the corresponding //​[[CL:​Glossary:​dimension]]//​. If the //​dimension-spec//​ is the //​[[CL:​Glossary:​symbol]]//​ **[[CL:​Types:​wildcard|*]]**,​ the set is not restricted on the basis of //​[[CL:​Glossary:​rank]]//​ or //​[[CL:​Glossary:​dimension]]//​.
 +====See Also====
 +**[[CL:​Variables:​*print-array*]]**,​ **[[CL:​Functions:​aref]]**,​ **[[CL:​Functions:​make-array]]**,​ **[[CL:​Types:​vector]]**,​ {\secref\SharpsignA},​ {\secref\PrintingOtherArrays}
 +Note that the type ''​(**array** **[[CL:​Types:​t]]**)''​ is a proper //​[[CL:​Glossary:​subtype]]//​ of the type ''​(**array** **[[CL:​Types:​wildcard|*]]**)''​. The reason is that the type ''​(**array** **[[CL:​Types:​t]]**)''​ is the set of //​[[CL:​Glossary:​array|arrays]]//​ that can hold any //​[[CL:​Glossary:​object]]//​ (the //​[[CL:​Glossary:​element|elements]]//​ are of type **[[CL:​Types:​t]]**,​ which includes all //​[[CL:​Glossary:​object|objects]]//​). On the other hand, the type ''​(**array** **[[CL:​Types:​wildcard|*]]**)''​ is the set of all //​[[CL:​Glossary:​array|arrays]]//​ whatsoever, including for example //​[[CL:​Glossary:​array|arrays]]//​ that can hold only //​[[CL:​Glossary:​character|characters]]//​. The type ''​(**array** **[[CL:​Types:​character]]**)''​ is not a //​[[CL:​Glossary:​subtype]]//​ of the type ''​(**array** **[[CL:​Types:​t]]**)'';​ the two sets are //​[[CL:​Glossary:​disjoint]]//​ because the type ''​(**array** **[[CL:​Types:​character]]**)''​ is not the set of all //​[[CL:​Glossary:​array|arrays]]//​ that can hold //​[[CL:​Glossary:​characters]]//,​ but rather the set of //​[[CL:​Glossary:​array|arrays]]//​ that are specialized to hold precisely //​[[CL:​Glossary:​characters]]//​ and no other //​[[CL:​Glossary:​object|objects]]//​.