User Tools


Differences

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

Link to this comparison view

cl:functions:listen [2019/06/15 02:00]
cl:functions:listen [2019/08/17 15:00] (current)
Line 1: Line 1:
 +====== Function LISTEN ======
 +
 +====Syntax====
 +  * **listen** ''&​optional''​ //​input-stream//​ → //​generalized-boolean//​
 +
 +====Arguments and Values====
 +  * //​input-stream//​ - an //​[[CL:​Glossary:​input]]//​ //​[[CL:​Glossary:​stream designator]]//​. The default is //​[[CL:​Glossary:​standard input]]//.
 +  * //​generalized-boolean//​ - a //​[[CL:​Glossary:​generalized boolean]]//​.
 +
 +====Description====
 +Returns //​[[CL:​Glossary:​true]]//​ if there is a character immediately available from //​input-stream//;​ otherwise, returns //​[[CL:​Glossary:​false]]//​. On a non-interactive //​input-stream//,​ **listen** returns //​[[CL:​Glossary:​true]]//​ except when at //​[[CL:​Glossary:​end of file]]//. If an //​[[CL:​Glossary:​end of file]]// is encountered,​ **listen** returns //​[[CL:​Glossary:​false]]//​. **listen** is intended to be used when //​input-stream//​ obtains characters from an interactive device such as a keyboard.
 +
 +====Examples====
 +<​blockquote> ​
 +([[CL:​Special Operators:​progn]] ​
 +  ([[CL:​Functions:​unread-char]] ([[CL:​Functions:​read-char]])) ​
 +  ([[CL:​Functions:​list]] (listen) ([[CL:​Functions:​read-char]])))
 +<​o>​__1__</​o>​
 + <​r>​(T #\1) </r>
 +([[CL:​Special Operators:​progn]] ​
 +  ([[CL:​Functions:​clear-input]]) ​
 +  (listen)) <​r>​[[CL:​Constant Variables:​NIL]] ; Unless you're a very fast typist! </r>
 +</​blockquote>​
 +
 +====Side Effects====
 +None.
 +
 +====Affected By====
 +**[[CL:​Variables:​star-standard-input-star|*standard-input*]]**
 +
 +====Exceptional Situations====
 +None.
 +
 +====See Also====
 +  * **[[CL:​Functions:​interactive-stream-p|Function INTERACTIVE-STREAM-P]]**
 +  * **[[CL:​Functions:​read-char-no-hang|Function READ-CHAR-NO-HANG]]**
 +
 +====Notes====
 +None.
 +