Input From Character Streams in LISP Last Updated : 11 Apr, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report This article is about input from character streams in LISP. Input in LISP can be taken in different ways like input from the user, input from character streams, etc. In LISP input from character streams can be taken from different functions accordingly. Input from character streams can be a string, character, character object, or line from a file. Based on the type of desired output, functions are selected. Functions To Take Input from Character Streams in LISPThere are different optional arguments along with the function to take input as a character stream. Some character stream input function arguments are input-stream, eof- error-p, and eof- value. ArgumentUsed forinput-streamthe input-stream argument takes the character stream from which the input is taken. eof-error-peof-error-p argument checks if the end of the file is reached while scanning the file. It has a default value of true which gives an error at end of the file otherwise false.eof-valueIf eof-error-p is false then it returns eof-value.List of Character Stream Input Functionsread & optional input-stream eof-error-p eof-value recursive-p: This function takes the input stream, constructs the Lisp object based on the description, and returns the object.read-line & optional input-stream eof-error-p eof-value recursive-p: This function takes the input stream as a parameter and returns the line of the input stream separated by a new line.read-char & optional input-stream eof-error-p eof-value recursive-p: This function takes input stream as a parameter reads one character and returns the character object.unread-char character & optional input-stream: This function takes the input stream as the reads a character from the input stream and puts it to the front of it and reads the next character.read-preserving-whitespace & optional in-stream eof-error-p eof-value recursive-p: This function under special conditions takes in a stream as a parameter and gives information about the character ended with a special token.read-delimited-list char & optional input-stream recursive-p: This function takes the input stream as a parameter, reads the objects from the character stream followed by a character, and returns the character object.peek-char & optional peek-type input-stream eof-error-p eof-value recursive-p: This function takes the input stream as a parameter and returns the next character without removing it.listen & optional input-stream: This function takes the input stream as a parameter and returns the predicate listen as true if the character in the input stream is available immediately, otherwise false.read-char-no-hang & optional input-stream eof-error-p eof-value recursive-p: It works similarly to read-char but returns nil if it has to wait for the character.clear-input & optional input-stream: This function clears the buffered input from the input stream.read-from-string string & optional eof-error-p eof-value & key: start: end: preserve - whitespace: This function takes a string as a parameter, builds an object by taking characters of the string one after the other, and returns the object.parse-integer string & key: start: end: radix: junk-allowed: This function takes string and starting and end delimiter as parameters and returns the part of a string starting with start and ending with end delimiter.Returns Value of Character Streams in LISPFunctionParameterReturnsread & optional input-stream eof-error-p eof-value recursive-pinput-streamLisp objectread-line & optional input-stream eof-error-p eof-value recursive-pinput-streamline of the input streamread-char & optional input-stream eof-error-p eof-value recursive-pinput-streamone characterunread-char character & optional input-streaminput-streamcharacterread-preserving-whitespace & optional in-stream eof-error-p eof-value recursive-pinput-streama character with a special tokenread-delimited-list char & optional input-stream recursive-pinput-streamcharacter objectpeek-char & optional peek-type input-stream eof-error-p eof-value recursive-pinput-streamnext character of the input streamlisten & optional input-stream input-streampredicate listenread-char-no-hang & optional input-stream eof-error-p eof-value recursive-pinput-streamcharacterclear-input & optional input-streaminput-stream-read-from-string string & optional eof-error-p eof-value & key: start: end: preserve - whitespacestringobjectparse-integer string & key: start: end: radix: junk-allowedstring, start, and end delimiterstring with start and end delimiters Comment More infoAdvertise with us Next Article Insert a character in String at a Given Position A aayushi2402 Follow Improve Article Tags : LISP LISP-Basics Similar Reads Formatted Output to Character Streams in LISP Lisp is a programming language that has an overall style that is organized around expressions and functions. Every Lisp procedure is a function, and when called, it returns a data object as its value. It is also commonly referred to as âfunctionsâ even though they may have side effects. Formatted Ou 2 min read Characters in LISP In Lisp data objects of type 'character' are referred to as characters. For representation purposes, we usually denote character objects by preceding a #\ symbol before the character. Any character can be represented by using the #\ symbol before the name of the character. For Example #\a represents 2 min read Taking Input from Users in Julia Reading user input is a way of interaction between the program and the user. User inputs are necessary in case of testing a piece of code with varying and legitimate inputs. Reading user inputs from console in Julia can be done through inbuilt I/O methods like : readline() readlines() Using readline 3 min read Insert a character in String at a Given Position Given a string s, a character c and an integer position pos, the task is to insert the character c into the string s at the specified position pos.Examples: Input: s = "Geeks", c = 'A', pos = 3Output: GeeAksInput: s = "HelloWorld", c = '!', pos = 5Output: Hello!WorldTable of Content[Approach-1] Usin 5 min read Input & Output in LISP Pre-requisites: Introduction to LISP Lisp provides a huge set of facilities for performing input/output. All the input/output operations are performed on streams of several kinds. While reading and writing binary data is possible, the majority of Common Lisp input/output methods read or write charac 9 min read Basic Syntax in LISP LISP is a list processing programming language. It is widely used in the manipulation of data strings. It provides an input and output library. LISP provides a macro system and provides well control structures for the manipulation of data. Basic Blocks in LISP:There are three basic building blocks o 2 min read Like