DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(guile.info.gz) Ports

Info Catalog (guile.info.gz) Input and Output (guile.info.gz) Reading
 
 27.1 Ports
 ==========
 
 [Concept of the port abstraction.]
 
    Sequential input/output in Scheme is represented by operations on a
 "port".  Characters can be read from an input port and written to an
 output port.  This chapter explains the operations that Guile provides
 for working with ports.
 
    The formal definition of a port is very generic: an input port is
 simply "an object which can deliver characters on command," and an
 output port is "an object which can accept characters."  Because this
 definition is so loose, it is easy to write functions that simulate
 ports in software.  "Soft ports" and "string ports" are two interesting
 and powerful examples of this technique.
 
  -- Scheme Procedure: input-port? x
  -- C Function: scm_input_port_p (x)
      Return `#t' if X is an input port, otherwise return `#f'.  Any
      object satisfying this predicate also satisfies `port?'.
 
  -- Scheme Procedure: output-port? x
  -- C Function: scm_output_port_p (x)
      Return `#t' if X is an output port, otherwise return `#f'.  Any
      object satisfying this predicate also satisfies `port?'.
 
  -- Scheme Procedure: port? x
  -- C Function: scm_port_p (x)
      Return a boolean indicating whether X is a port.  Equivalent to
      `(or (input-port? X) (output-port?  X))'.
 
Info Catalog (guile.info.gz) Input and Output (guile.info.gz) Reading
automatically generated byinfo2html