User Tools


Differences

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

Link to this comparison view

cl:functions:svref [2019/11/11 05:00]
cl:functions:svref [2019/11/17 07:00] (current)
Line 1: Line 1:
 +====== Accessor SVREF ======
 +
 +====Syntax====
 +  * **svref** //​simple-vector index// → //element//
 +  * (**setf** (**svref** //​simple-vector index//) //​new-element//​)
 +
 +====Arguments and Values====
 +  * //​simple-vector//​ - a //​[[CL:​Glossary:​simple vector]]//.
 +  * //index// - a //​[[CL:​Glossary:​valid array index]]// for the //​simple-vector//​.
 +  * //​element//,​ //​new-element//​ - an //​[[CL:​Glossary:​object]]//​ (whose //​[[CL:​Glossary:​type]]//​ is a //​[[CL:​Glossary:​subtype]]//​ of the //​[[CL:​Glossary:​array element type]]// of the //​simple-vector//​).
 +
 +====Description====
 +//​[[CL:​Glossary:​access|Accesses]]//​ the //​[[CL:​Glossary:​element]]//​ of //​simple-vector//​ specified by //index//.
 +
 +====Examples====
 +<​blockquote> ​
 +([[CL:​Macros:​defparameter]] *v* ([[CL:​Functions:​vector]] 1 2 '​sirens)) <​r>​*V*</​r>​
 +([[CL:​Functions:​simple-vector-p]] *v*) <​r>//​[[CL:​Glossary:​true]]//​ </r>
 +(svref *v* 0) <r>1 </r>
 +(svref *v* 2) <​r>​SIRENS </r>
 +([[CL:​Macros:​setf]] (svref *v* 1) '​newcomer) <​r>​NEWCOMER</​r>​
 +*v* <​r>#​(1 NEWCOMER SIRENS) </r>
 +</​blockquote>​
 +
 +====Side Effects====
 +None.
 +
 +====Affected By====
 +None.
 +
 +====Exceptional Situations====
 +None.
 +
 +====See Also====
 +
 +**[[CL:​Functions:​aref|Function AREF]]**, **[[CL:​Functions:​sbit|Function SBIT]]**, **[[CL:​Functions:​schar|Function SCHAR]]**, **[[CL:​Functions:​vector|Function VECTOR]]**, {\secref\ConstantModification}
 +
 +====Notes====
 +**[[CL:​Functions:​svref]]** is identical to **[[CL:​Functions:​aref]]** except that it requires its first argument to be a //​[[CL:​Glossary:​simple vector]]//.
 +
 +<​blockquote> ​
 +(svref //v// //i//) ≡ ([[CL:​Functions:​aref]] ([[CL:​Special Operators:​the]] [[CL:​Types:​simple-vector]] //v//) //​i//​) ​
 +</​blockquote>​
 +
 +\issue{CONSTANT-MODIFICATION:​DISALLOW}