chickadee » fox » fox

(fox <object> [<pre-string>] [<port>] [<width>] [<char>] [<writer>] [<merge>] [<take>] [<separator>] [<post-string>] ...)procedure

<merge> --> ([<precision>] [<point>] [<radix>] [<sign>] [<exactness>])

The <merge> is a list whose elements are <precision>, <point>, <radix>, <sign>, and <exactness>. The <precision> <point> <radix> <sign> <exactness> are effective only for the number type of <object>. Except <string>s, the order of all other optional arguments does not matter. When there is a <string> or <string>s without the other optional arguments, the <string> or <string>s are <post-string>. The FOX process the optional arguments in the following order; <writer>, <exactness>, <point>, <precision>, <radix>, <separator>, <sign>, <take>, <width>, <char>, <string>, <port>.

1. The <object> is any Scheme object.

2. The <width> is an 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, or it is placed in the center (near to right in case of positive <width>, or near to left in case of negative <width>) with the rest being padded with <char>s, if <width> is an inexact integer. On the other hand, when the resulting string has more characters than the absolute value of <width>, lthe <width> is ignored. The default value is 0.

3. The <writer> is a procedure of two arguments; <object> and a string port. It writes <object> to the string port. The default value is DISPLAY 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. When <writer> except DISPLAY and WRITE procedures is used, the optional arguments that are effective only for the number type of <object> become ineffective.

  

4. The <port> is an output port or a boolean. If an output port is specified, the resulting string is output into the port. If <port> is #t, the output port is current output port. If <port> is #f, the resulting string is returned. The default value is #f.

5. The <char> is a padding character. The default value is #\space.

6. The <take> is a pair whose car and cdr values are exact integers or strings or procedures; m and n, and the absolute values of m and n are M and N, respectively. First, When the car element is an exact integer, the resulting string takes from the left m-characters, if it is positive, or all the characters but M-characters, if non-positive. When the car element is a string, the string is prefixed. When the car element is a procedure, the procedure takes a string argument and returns a string as a pipe. Second, When the cdr element is an exact integer, the resulting string takes from the right n-characters of the string that is processed by the car element, if it is positive, or all the characters but N-characters, if non-positive. When the cdr element is a string, the string is postfixed to the string that is processed by the car element. When the cdr element is a procedure, the procedure takes the string processed by the car element as an argument and returns a string.

  

7. The <separator> is a vector whose first element is a string serving as a separator and second element is a non-zero exact integer; n, and the absolute value of n is N. The resulting string is separated in every N-characters of the resulting string from right end, if n is positive, or from left end, if n is negative. Even if n is a negative integer, its absolute value is used for the number type of <object>. When the integer is omitted, the <separator> is effective only for the number type of <object> and its default value is 3.

8. The <point> is a symbol: fixed or float. Each returns a string of decimal fraction or exponential representation.

9. The <precision> is a non-negative exact integer that specifies the number of decimal digits after a decimal point.

10. The <radix> is a symbol: binary, octal, decimal, or hexadecimal. Each radix sign except decimal is prefixed to the resulting string. The default value is decimal.

11. 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.

12. The <exactness> is a symbol: exact or inexact. Each returns a string of exact or inexact representation.

13. The resulting string is prefixed with <pre-string> and postfixed with <post-string>s.