Formatted output of terms (not in ISO)

The predicate format(Format,L), which mimics the printf function in C, prints the elements in the list L under the control of Format, which is a string of characters. There are two kinds of characters in Format: normal characters are output verbatim, and control characters format the elements in L. Control characters all start with ~. For example,
      format("~thello~t world~t~a~t~4c~t~4d~t~7f",[atom,0'x,123,12.3])
gives the following output:
      hello    world  atom    xxxx     123        12.300000
The control characters ~a, ~4c,~4d, and ~7f control the output of the atom atom, the character 0'x, the integer 123, and the float 12.3, respectively. The control characters ~t put the data into different columns.

The following control characters are supported:

Neng-Fa Zhou 2013-01-25