Scheme Printing (Output)
Scheme is an expression-based functional language. It has no formal output command. When you type any sort of expression, whether it contains integers, a string, a call to a built-in function, or a variable, the interactive Scheme terminal will simply evaluate the expression to the best of its ability and display the answer. If the expression is its most evaluated form, Scheme just echoes the value. For example,
2 => 2 "Hello World" => "Hello World" '(a b) => (list 'a 'b)If you type an identifier that has already been defined previously in the current scope, Scheme will return to you the current value, or, in the case of a simple function that's been defined before, the function's identifying name. For example,
(define x 5) ... x => 5or
(define square (lambda (x) (* x x))) ... square => squareThe semantic structure is as follows:
Env_0 I/O_0 exprlist Return: Val_0, ... I/0_1 = I/O_0 + (terminal_output:Val_0, ...)This construction returns only the evaluation of an expression, which is output to the screen.
(display "(a b c)") => (a b c) (display '("a b" c)) => (a b c)The semantic structure of this statement is as follows:
Env_0 I/O_0 ( display object ;most often a string, but it seems that display parses the characters (tokens) looking for strings ;and characters only, and prints them to the screen. Return:Val_0 ;the string created by the parsing action of the display statement ) Env_0 I/O_1 = I/O_0 + (terminal_output:Val_0)