User Tools

A PCRE internal error occured. This might be caused by a faulty plugin

====== Function CLEAR-INPUT ====== ====Syntax==== * **clear-input** ''&optional'' //input-stream// → **[[CL:Constant Variables:nil]]** ====Arguments and Values==== * //input-stream// - an //[[CL:Glossary:input]]// //[[CL:Glossary:stream designator]]//. The default is //[[CL:Glossary:standard input]]//. ====Description==== Clears any available input from //input-stream//. If **clear-input** does not make sense for //input-stream//, then **clear-input** does nothing. ====Examples==== The exact I/O behavior of this example might vary from //[[CL:Glossary:implementation]]// to //[[CL:Glossary:implementation]]// depending on the kind of //[[CL:Glossary:interactive]]// buffering that occurs. (The call to **[[CL:Functions:sleep]]** here is intended to help even out the differences in //[[CL:Glossary:implementation|implementations]]// which do not do line-at-a-time buffering.) <blockquote> ([[CL:Macros:defun]] read-sleepily (&optional (clear-p [[CL:Constant Variables:nil]]) (zzz 0)) ([[CL:Functions:list]] ([[CL:Special Operators:progn]] ([[CL:Functions:print]] '>) ([[CL:Functions:read]])) ;; Note that input typed within the first ;; ZZZ seconds will be discarded. ([[CL:Special Operators:progn]] ([[CL:Functions:print]] '>) ([[CL:Macros:when]] zzz ([[CL:Functions:sleep]] zzz)) ([[CL:Functions:print]] '>>) ([[CL:Macros:when]] clear-p (clear-input)) ([[CL:Functions:read]])))) (read-sleepily) <o>> __10__ > >> __20__ </o> → (10 20) (read-sleepily t) <o>> __10__ > >> __20__ </o> → (10 20) (read-sleepily t 10) <o>> __10__ > __20__ ; Some implementations won't echo typeahead here. >> __30__ </o> → (10 30) </blockquote> ====Side Effects==== The //input-stream// is modified. ====Affected By==== **[[CL:Variables:star-standard-input-star|*standard-input*]]** ====Exceptional Situations==== Should signal an error of type type-error if //input-stream// is not a //[[CL:Glossary:stream designator]]//. ====See Also==== * **[[CL:Functions:clear-output|Function CLEAR-OUTPUT]]** ====Notes==== None.