Search

( CAT object formatting-specifier ... ) string?
formatting-specifier
<exactness%>
symbol: exact or inexact
<radix%>
symbol: binary, octal, decimal, or hexadecimal
<sign%>
if <sign%> is a symbol that takes the form of 'sign, and object is a positive number without a positive sign, the positive sign is prefixed to the resulting string
<precision%>
inexact integer whose absolute value specifies the number of decimal digits after a decimal point. If <precision%> is a non-negative integer, an exact sign is prefixed to the resulting string as needed
<separator%>
a list whose first element is a character serving as a separator and second element is a positive exact integer. If the integer is n, the resulting string is separated in every n-characters of the resulting string. When the integer is omitted, the default value is 3.
<writer$>
a procedure of two arguments; object and a string port. It writes object to the string port. The default value of <writer$> is varied according to the type of object. When object is a self-evaluating constant, it becomes equivalent to DISPLAY procedure, otherwise, it becomes WRITE procedure. If you want any objects to be displayed in your own way, you have to define your own <writer$>. Otherwise, they are displayed simply in their evaluated forms
<pipe>
a list which is composed of one or more procedures. Each procedure takes at least one string argument and returns a string. One procedure connects with another as a pipe
<take>
a list whose elements are two exact integers; n and m, and the absolute values of n and m are N and M, respectively. First, the resulting string takes from the left n-characters, if it is non-negative, or all the characters but N-characters, if negative. Second, it takes from the right m-characters, if it is non-negative, or all the characters but M-characters, if negative. Then, it concatenates two set of characters taken. The second element can be omitted. If omitted, the default value is 0
<converter>
a pair whose car value is a predicate procedure that checks whether object satisfies it, and cdr value is a procedure that takes the object as an argument and returns a string. When object satisfies the predicate procedure, all optional arguments are ineffective except <width>, <char>, <port>, and <string>
<width>
an exact integer whose absolute value specifies the width of the resulting string. When the resulting string has fewer characters than the absolute value of <width>, it is placed rightmost with the rest being padded with <char>s, if <width> is positive, or it is placed leftmost with the rest being padded with <char>s, if <width> is negative. On the other hand, when the resulting string has more characters than the absolute value of <width>, the <width> is ignored. The default value is 0
<char>
a padding character. The default value is #\space
<port>
an output port or a boolean. If an output port is specified, the resulting string and <string>s are output into that port and simultaneously returned as a string. If <port> is #t, the output port is current output port. If <port> is #f, the output is only returned as a string. The default value is #f
<string>
a string that is appended to the resulting string
( format [ string? format-string ] obj ... ) string?
format-string
~a
The corresponding value is inserted into the string as if printed with display.
~s
The corresponding value is inserted into the string as if printed with write.
~%A
A newline is inserted.
~~
A tilde '~' is inserted.
( format [ string? format-string ] obj ... ) string? ( format [ #f port ] [ string? format-string ] obj ... ) string? ( format [ output-port? port ] [ string? format-string ] obj ... )
format-string
~a
Mnemonic: Any. Action: (display obj) for humans. Consumes: yes
~s
Mnemonic: Slashified. Action: (write obj) for parsers. Consumes: yes
~w
Mnemonic: WriteCircular. Action: (write-with-shared-structure obj) like ~s, but handles recursive structures. Consumes: yes
~d
Mnemonic: Decimal. Action: the obj is a number which is output in decimal radix. Consumes: yes
~x
Mnemonic: heXadecimal. Action: the obj is a number which is output in hexdecimal radix. Consumes: yes
~o
Mnemonic: Octal. Action: the obj is a number which is output in octal radix. Consumes: yes
~b
Mnemonic: Binary. Action: the obj is a number which is output in binary radix. Consumes: yes
~c
Mnemonic: Character. Action: the single charater obj is output by write-char. Consumes: yes
~y
Mnemonic: Yuppify. Action: the list obj is pretty-printed to the output. Consumes: yes
~?
Mnemonic: Indirection. Action: the obj is another format-string and the following obj is a list of arguments; format is called recursively. Consumes: yes
~K
Mnemonic: Indirection. Action: the same as ~? for backward compatability with some existing implementations. Consumes: yes
~[w[,d]]F
Mnemonic: Fixed. Action: ~w,dF outputs a number with width w and d digits after the decimal; ~wF outputs a string or number with width w. Consumes: yes
~~
Mnemonic: Tilde. Action: output a tilde. Consumes: no
~t
Mnemonic: Tab. Action: output a tab character. Consumes: no
~%
Mnemonic: Newline. Action: output a newline character. Consumes: no
~&
Mnemonic: Freshline. Action: output a newline character if it is known that the previous output was not a newline. Consumes: no
~_
Mnemonic: Space. Action: a single space character is output. Consumes: no
~h
Mnemonic: Help. Action: outputs one line of call synopsis, one line of comment, and one line of synopsis for each format directive, starting with the directive (e.g. "~t"). Consumes: no
( get-environment-variable [ string? name ] ) ( or string? #f )
Many operating systems provide each running process with an environment consisting of environment variables. (This environment is not to be confused with the Scheme environments that can be passed to eval: see section 6.12.) Both the name and value of an environment variable are strings. The procedure get-environment-variable returns the value of the environment variable name, or #f if the named environment variable is not found. It may use locale information to encode the name and decode the value of the environment variable. It is an error if get-environment-variable can’t decode the value. It is also an error to mutate the resulting string.
( get-output-string [ output-port? port ] ) string?
It is an error if port was not created with open-output-string. Returns a string consisting of the characters that have been output to the port so far in the order they were output. If the result string is modified, the effect is unspecified.
( get-output-string [ output-port? port ] ) string?
It is an error if port was not created with open-output-string. Returns a string consisting of the characters that have been output to the port so far in the order they were output. If the result string is modified, the effect is unspecified.
( list->string [ list? list ] ) string?
list ' ( [ char? c ] ... )
string->list, list->string The string->list procedure returns a newly allocated list of the characters of string between start and end. list->string returns a newly allocated string formed from the elements in the list list. In both procedures, order is preserved. string->list and list->string are inverses so far as equal? is concerned.
( make-string [ integer? k ] ) string? ( make-string [ integer? k ] [ char? char ] ) string?
The make-string procedure returns a newly allocated string of length k. If char is given, then all the characters of the string are initialized to char, otherwise the contents of the string are unspecified.
( number->string [ number? z ] ) string? ( number->string [ number? z ] [ integer? radix ] ) string?
It is an error if radix is not one of 2, 8, 10, or 16. The procedure number->string takes a number and a radix and returns as a string an external representation of the given number in the given radix. It is an error if no possible result makes this expression true. If omitted, radix defaults to 10. If z is inexact, the radix is 10, and the above expression can be satisfied by a result that contains a decimal point, then the result contains a decimal point and is expressed using the minimum number of digits (exclusive of exponent and trailing zeroes) needed to make the above expression true [4, 5]; otherwise the format of the result is unspecified. The result returned by number->string never contains an explicit radix prefix. Note: The error case can occur only when z is not a complex number or is a complex number with a non-rational real or imaginary part. Rationale: If z is an inexact number and the radix is 10, then the above expression is normally satisfied by a result containing a decimal point. The unspecified case allows for infinities, NaNs, and unusual representations.
( read-line ) ( or eof-object? string? ) ( read-line [ input-port? port ] ) ( or eof-object? string? )
Returns the next line of text available from the textual input port, updating the port to point to the following character. If an end of line is read, a string containing all of the text up to (but not including) the end of line is returned, and the port is updated to point just past the end of line. If an end of file is encountered before any end of line is read, but some characters have been read, a string containing those characters is returned. If an end of file is encountered before any characters are read, an end-of-file object is returned. For the purpose of this procedure, an end of line consists of either a linefeed character, a carriage return character, or a sequence of a carriage return character followed by a linefeed character. Implementations may also recognize other end of line characters or sequences.
( sort [ vector? sequence ] [ procedure? less? ] ) vector? ( sort [ vector? sequence ] [ procedure? less? ] [ procedure? key ] ) vector? ( sort [ list? sequence ] [ procedure? less? ] ) list? ( sort [ list? sequence ] [ procedure? less? ] [ procedure? key ] ) list? ( sort [ string? sequence ] [ procedure? less? ] ) string? ( sort [ string? sequence ] [ procedure? less? ] [ procedure? key ] ) string?
less? ( λ x y ) boolean?
key ( λ obj ) *