Prev
Up
Next
Scheme contains some other data types. One is the
procedure. We have already seen many procedures, eg,
display,
+,
cons. In reality, these are
variables holding the procedure values, which are
themselves not visible as are numbers or characters:
cons
=> <procedure>
The procedures we have seen thus far are primitive
procedures, with standard global variables holding them.
Users can create additional procedure values.
Yet another data type is the port. A port is the
conduit through which input and output is performed.
Ports are usually associated with files and consoles.
In our ``Hello, World!'' program, we used the
procedure display to write a string to the console.
display can take two arguments, one the value to be
displayed, and the other the output port it should be
displayed on.
In our program, display's second argument was
implicit. The default output port used is the standard
output port. We can get the current standard output
port via the procedure-call (current-output-port).
We could have been more explicit and written
(display "Hello, World!" (current-output-port))
Prev
Up
Next