~c
(tilde, followed by some character) is
found, the format derivates will first check whether the user has
defined a predicate to handle the format. If not, the built in
formatting rules described above are used. Char is either an
ascii value, or a one character atom, specifying the letter to be
(re)defined. Head is a term, whose name and arity are used
to determine the predicate to call for the redefined formatting
character. The first argument to the predicate is the numeric
argument of the format command, or the atom default
if no
argument is specified. The remaining arguments are filled from the
argument list. The example below redefines ~n
to produce
Arg times return followed by linefeed (so a (Grr.) DOS machine is
happy with the output).
:- format_predicate(n, dos_newline(_Arg)). dos_newline(Arg) :- between(1, Ar, _), put(13), put(10), fail ; true.