Download STK Reference manual
Transcript
STk Reference Manual 27 procedure procedure (read-line) (read-line port) Reads the next line available from the input port port and returns it as a string. The terminating newline is not included in the string. If no more characters are available, an end of file object is returned. Port may be omitted, in which case it defaults to the value returned by current-input-port. (write obj ) (write obj port) procedure procedure Identical to R4 RS. (write* obj ) (write* obj port) procedure procedure Writes a written representation of obj to the given port. The main difference with the write procedure is that write* handles data structures with cycles. Circular structure written by this procedure use the “#x=” and “#x#” notations (see 2.3). As write, the port argument can be omitted, defaulting to the value returned by current-output-port, and the value returned by write* is undefined. (let ((l (cons 1 2))) (set-cdr! l l) (write* l)) =⇒ writes #0=(1 . #0#) (let ((l1 ’(1 (l2 ’(3 (l3 ’(5 (append! l1 (list l1 l2 =⇒ writes ((1 2 . #0=(3 4 . #1=(5 6))) #0# #1#) 2)) 4)) 6))) l2 l3) l3)) (display obj ) (display obj port) (newline) (newline port) (write-char char) (write-char char port) procedure procedure procedure procedure procedure procedure Identical to R4 RS. (format port string obj1 obj2 . . . ) procedure Writes the obj s to the given port , according to the format string string. String is written literally, except for the following sequences: • ~a or ~A is replaced by the printed representation of the next obj . • ~s or ~S is replaced by the “slashified” printed representation of the next obj .