User Tools


Differences

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

Link to this comparison view

cl:functions:terpri [2019/09/14 05:00]
cl:functions:terpri [2019/09/20 16:00] (current)
Line 1: Line 1:
 +====== Function TERPRI, FRESH-LINE ======
 +
 +====Syntax====
 +  * **terpri** ''&​optional''​ //​output-stream//​ → **[[CL:​Constant Variables:​nil]]**
 +  * **fresh-line** ''&​optional''​ //​output-stream//​ → //​generalized-boolean//​
 +
 +====Arguments and Values====
 +  * //​output-stream//​ - an //​[[CL:​Glossary:​output]]//​ //​[[CL:​Glossary:​stream designator]]//​. The default is //​[[CL:​Glossary:​standard output]]//.
 +  * //​generalized-boolean//​ - a //​[[CL:​Glossary:​generalized boolean]]//​.
 +
 +====Description====
 +**terpri** outputs a //​[[CL:​Glossary:​newline]]//​ to //​output-stream//​.
 +
 +**fresh-line** is similar to **terpri** but outputs a //​[[CL:​Glossary:​newline]]//​ only if the //​output-stream//​ is not already at the start of a line. If for some reason this cannot be determined, then a //​[[CL:​Glossary:​newline]]//​ is output anyway. **fresh-line** returns //​[[CL:​Glossary:​true]]//​ if it outputs a //​[[CL:​Glossary:​newline]]//;​ otherwise it returns //​[[CL:​Glossary:​false]]//​.
 +
 +====Examples====
 +<​blockquote>​
 +(with-output-to-string (s) 
 +  (write-string "some text" s) 
 +  (terpri s) 
 +  (terpri s) 
 +  (write-string "more text" s)) 
 +<​r>"​some text
 +
 +more text"</​r>​
 +(with-output-to-string (s) 
 +  (write-string "some text" s) 
 +  (fresh-line s) 
 +  (fresh-line s) 
 +  (write-string "more text" s))
 +<​r>"​some text
 +more text"</​r>​
 +</​blockquote>​
 +
 +====Side Effects====
 +The //​output-stream//​ is modified.
 +
 +====Affected By====
 +  * **[[CL:​Variables:​star-standard-output-star|Variable *STANDARD-OUTPUT*]]**
 +  * **[[CL:​Variables:​star-terminal-io-star|Variable *TERMINAL-IO*]]**.
 +
 +====Exceptional Situations====
 +None.
 +
 +====See Also====
 +None.
 +
 +====Notes====
 +<​blockquote>​
 +(terpri //​output-stream//​) ≡ ([[CL:​Functions:​write-char]] #\Newline //​output-stream//​)
 +</​blockquote>​
 +