(rontolisp) docs
← IO

format

(format fmt args...)

Answers the format string rendered as java.util.Formatter renders it: %s/%S convert like str, %b/%B the boolean spelling, %c/%C a character, %d/%o/%x/%X an integer (the octal and hexadecimal of a negative long in two's complement), %e/%E/%f/%g/%G a double (rounded half up from the shortest decimal it prints as), %% and %n themselves. Every flag (- # + space 0 , (), width, precision and argument index (%2$s, %<s) is the oracle's, and nil spells null under any conversion.

A malformed format string, a flag its conversion does not take, a missing argument or one of the wrong class is the oracle's refusal (MissingFormatWidthException, IllegalFormatConversionException ...) with its message, signalled after the arguments are evaluated. A literal format string is parsed when the program is read, a computed one when the call runs, with the same renderings and refusals -- so format works as a value too ((apply format fmt cols)). %h, %a and the date conversions %t are refused when the call runs, so a function spelling one is defined.