The Format Module


format [Generic]

Format a string and write it to a stream.

Synopsis

format ( stream , control-string , #rest args ) => ()

Parameters

stream An instance of <stream>.
control-string An instance of <string>.
args Instances of <object>. The objects to substitute for the format fields.

Return Values

None.

Description

The format function takes a control string, formats according to the format directives embedded in the string, and then writes the result to the stream argument.

The format codes accepted by format are described in the format directives section.


format[Method]

Format a string and write it to a stream.

Synopsis

format ( stream , control-string , #rest args) => ()

Parameters

stream An instance of <stream>.
control-string An instance of <string>.
argsInstances of <object>. The objects to substitute for the format fields.

Return Values

None.

Description

The default format method, specialized on the <stream> class.


format-to-string[Function]

Process a format-string and return the result as another string.

Synopsis

format-to-string ( control-string , #rest args ) => ( result )

Parameters

control-string An instance of <string>.
args Instances of <object>. The objects to substitute for the format fields.

Return Values

result An instance of <string>.

Description

This function effectively calls format and returns the result as a string.


print-message [ Open Generic]

This method is called to format objects for the "%s" and "%c" format operators, in a form suitable for human readers.

Synopsis

print-message (object, stream) => ()

Parameters

objectAn instance of <object>.
streamAn instance of <stream>.

Return Values

None.

Description

Prints object to stream. This generic function is intended to define the human-readable printing behavior of a Dylan object, as opposed to their representation as literal syntax. Calling this function on <condition> should result in a error message, rather than the name of the instance and its class, for example. (Contrast this behavior with the print function in the Print library.)

Predefined methods exist for the <string> , <character> , <condition> , and <symbol> classes.