previous chapterthe pico pagenext chapter


Communication functions

Pico also provides means for communication between a running program and the outside world. Typically the function display allows any value to be sent to the transcript -typically a computer screen- while the function accept retrieves a fragment of text -typically from a keyboard. The following transcript illustrates the use of the display function:

Note that display can take any number of arguments. We do not know yet how to define a function that behaves in this way; again we refer to the next chapter for more details. Also note that a native variable eoln is available: whenever displayed, the value bound to eoln generates a line break in the text printed to the transcript.

The accept function is illustrated in the following transcript:

The function accept takes no arguments; whenever applied, it produces some audio prompt -represented by the bell symbol- to warn that input is required. Evaluation is then resumed after the input is terminated -indicated by for instance an enter-key on the computer keyboard. The value of the accept function is the text representing the entered string of characters. Note that the result is text, even if only digits were entered. Converting text consisting of digits into a number will be discussed in one of the following paragraphs.


previous chapterthe pico pagenext chapter