User Tools


Differences

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

Link to this comparison view

cl:functions:write-sequence [2019/11/11 05:00]
cl:functions:write-sequence [2019/11/22 14:00] (current)
Line 1: Line 1:
 +====== Function WRITE-SEQUENCE ======
 +
 +====Syntax====
 +  * **write-sequence** //​sequence//​ //stream// ''&​key''​ //start// //end// → //​sequence//​
 +
 +====Arguments and Values====
 +  * //​sequence//​ - a //​[[CL:​Glossary:​sequence]]//​.
 +  * //stream// - an //​[[CL:​Glossary:​output]]//​ //​[[CL:​Glossary:​stream]]//​.
 +  * //start//, //end// - //​[[CL:​Glossary:​bounding index designator|bounding index designators]]//​ of //​sequence//​. The defaults for //start// and //end// are ''​0''​ and **[[CL:​Constant Variables:​nil]]**,​ respectively.
 +
 +====Description====
 +**write-sequence** writes the //​[[CL:​Glossary:​element|elements]]//​ of the subsequence of //​sequence//​ //​[[CL:​Glossary:​bounded]]//​ by //start// and //end// to //stream//.
 +
 +====Examples====
 +<​blockquote> ​
 +(write-sequence "​bookworms"​ [[CL:​Variables:​star-standard-output-star|*standard-output*]] :end 4)
 +<​r>​book </r>
 +<​r>"​bookworms"​ </r>
 +</​blockquote>​
 +
 +====Side Effects====
 +Modifies //stream//.
 +
 +====Affected By====
 +None.
 +
 +====Exceptional Situations====
 +Should be prepared to signal an error of type type-error if //​sequence//​ is not a //​[[CL:​Glossary:​proper sequence]]//​. Should signal an error of type type-error if //start// is not a non-negative //​[[CL:​Glossary:​integer]]//​. Should signal an error of type type-error if //end// is not a non-negative //​[[CL:​Glossary:​integer]]//​ or **[[CL:​Constant Variables:​nil]]**.
 +
 +Might signal an error of type **[[CL:​Types:​type-error]]** if an //​[[CL:​Glossary:​element]]//​ of the //​[[CL:​Glossary:​bounded]]//​ //​[[CL:​Glossary:​sequence]]//​ is not a member of the //​[[CL:​Glossary:​stream element type]]// of the //stream//.
 +
 +====See Also====
 +  * {\secref\ConstantModification}
 +  * **[[CL:​Functions:​read-sequence|Function READ-SEQUENCE]]**
 +  * **[[CL:​Functions:​write-string|Function WRITE-STRING]]**
 +  * **[[CL:​Functions:​write-line|Function WRITE-LINE]]**
 +
 +====Notes====
 +*write-sequence** is identical in effect to iterating over the indicated subsequence and writing one //​[[CL:​Glossary:​element]]//​ at a time to //stream//, but may be more efficient than the equivalent loop. An efficient implementation is more likely to exist for the case where the //​sequence//​ is a //​[[CL:​Glossary:​vector]]//​ with the same //​[[CL:​Glossary:​element type]]// as the //stream//.
 +