www.delorie.com/gnu/docs/kawa/kawa_50.html   search  
 
Buy GNU books!


Kawa, the Java-based Scheme system

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.3 Formatted Output (Common-Lisp-style)

Function: format destination fmt . arguments
An almost complete implementation of Common LISP format description according to the CL reference book Common LISP from Guy L. Steele, Digital Press. Backward compatible to most of the available Scheme format implementations.

Returns #t, #f or a string; has side effect of printing according to fmt. If destination is #t, the output is to the current output port and #!void is returned. If destination is #f, a formatted string is returned as the result of the call. If destination is a string, destination is regarded as the format string; fmt is then the first argument and the output is returned as a string. If destination is a number, the output is to the current error port if available by the implementation. Otherwise destination must be an output port and #!void is returned.

fmt must be a string or an instance of gnu.text.MessageFormat or java.text.MessageFormat. If fmt is a string, it is parsed as if by parse-format.

Function: parse-format format-string
Parses format-string, which is a string of the form of a Common LISP format description. Returns an instance of gnu.text.ReportFormat, which can be passed to the format function.

A format string passed to format or parse-format consists of format directives (that start with `~'), and regular characters (that are written directly to the destination). Most of the Common Lisp (and Slib) format directives are implemented. Neither justification, nor pretty-printing are supported yet.

Plus of course, we need documentation for format!


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003