User Tools


Differences

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

Link to this comparison view

cl:functions:array-total-size [2019/11/11 05:00]
cl:functions:array-total-size [2019/11/13 17:00] (current)
Line 1: Line 1:
 +====== Function ARRAY-TOTAL-SIZE ======
 +
 +====Syntax====
 +  * **array-total-size** //array// → //size//
 +
 +====Arguments and Values====
 +  * //array// - an //​[[CL:​Glossary:​array]]//​.
 +  * //size// - a non-negative //​[[CL:​Glossary:​integer]]//​.
 +
 +====Description====
 +Returns the //​[[CL:​Glossary:​array total size]]// of the //array//.
 +
 +====Examples====
 +
 +<​blockquote> ​
 +(array-total-size ([[CL:​Functions:​make-array]] 4)) <r>4 </r>
 +(array-total-size ([[CL:​Functions:​make-array]] 4 :​fill-pointer 2)) <r>4 </r>
 +(array-total-size ([[CL:​Functions:​make-array]] 0)) <r>0 </r>
 +(array-total-size ([[CL:​Functions:​make-array]] '(4 2))) <r>8 </r>
 +(array-total-size ([[CL:​Functions:​make-array]] '(4 0))) <r>0 </r>
 +(array-total-size ([[CL:​Functions:​make-array]] '())) <​r>​1</​r>​
 +</​blockquote>​
 +
 +====Affected By====
 +None.
 +
 +====Exceptional Situations====
 +Should signal an error of type **[[CL:​Types:​type-error]]** if its argument is not an //​[[CL:​Glossary:​array]]//​.
 +
 +====See Also====
 +**[[CL:​Functions:​make-array|Function MAKE-ARRAY]]**,​ **[[CL:​Functions:​array-dimensions|Function ARRAY-DIMENSIONS]]**
 +
 +====Notes====
 +If the //array// is a //​[[CL:​Glossary:​vector]]//​ with a //​[[CL:​Glossary:​fill pointer]]//,​ the //​[[CL:​Glossary:​fill pointer]]// is ignored when calculating the //​[[CL:​Glossary:​array total size]]//.
 +
 +Since the product of no arguments is one, the //​[[CL:​Glossary:​array total size]]// of a zero-dimensional //​[[CL:​Glossary:​array]]//​ is one.
 +
 +<​blockquote>​
 +(array-total-size x) 
 +  ≡ ([[CL:​Functions:​apply]] #'​[[CL:​Functions:​multiply|*]] ([[CL:​Functions:​array-dimensions]] x)) 
 +  ≡ ([[CL:​Functions:​reduce]] #'​[[CL:​Functions:​multiply|*]] ([[CL:​Functions:​array-dimensions]] x))
 +</​blockquote>​
 +