Formatting

The :std/format library implements string formatting as specified in SRFI 48.

usage

(import :std/format)

format

usage

(format fmt . args)
  fmt   := string
  args  := mixed values

<= string

Formats the arguments to a string using the supplied format specifier.

Differences with SRFI 48

  • lower-case synonyms for all format specifiers (~a and ~A are equivalent)
  • ~u/~U for unicode hex char print (for #\uXXXX)
  • ~f/~F means "float" and does non-exp fp (C-style %f more or less)
  • ~w{spec} does generic fixed width
  • not implemented: ~& ~H wtfs

fprintf

usage

(fprintf port fmt . args)
  port  := ouput-port
  fmt   := string
  args  := mixed values

Same as format but outputs to a specific output port.

printf

usage

(printf fmt . args)
  fmt   := string
  args  := mixed values

<= null

Same as fprintf but with the output port defaulted to (current-output-port)

eprintf

usage

(eprintf fmt . args)
  fmt   := string
  args  := mixed values

<= null

Same as fprintf but with the output port defaulted to (current-error-port)