GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Try online
  • GitLab
  • GitHub

This view

  • Original page
  • New address

GeezerVison is showing urn-lang.com — data/format | Urn

data/format

(format out str &args)

Macro defined at lib/data/format.lisp:117:2

Output the string STR formatted against ARGS to the stream OUT. In the case OUT is nil, a string in returned; If OUT is true, the result is printed to standard output.

Formatting specifiers

Formatting specifiers take the form {...}, where ... includes both a reference (what’s to be output) and a formatter (how to output it).

  • If the reference starts with #, it is an implicit named symbol (something in scope, and not passed explicitly).
  • If the reference starts with an alphabetic character, it is named: something given to the format macro explicitly, as a keyword argument.
  • If the reference starts with $, it is a positional argument.

The formatter can either start with :, in which case it references an Urn symbol, or start with %, in which case it is a string.format format sequence.

Examples

> (format nil "{#pretty:pretty} is {what}" :what 'pretty)
out = "«method: (pretty x)» is pretty"
> (format nil "0x{foo%x}" :foo 123)
out = "0x7b"

Tutorial

  • An Introduction to Urn
  • Guess the number
  • Finding errors
  • Macros and more
  • How do I do X?
  • Integrating with Lua
  • The compiler API

Reference

  • Syntax
  • Special forms
  • CLI
  • The REPL

Recent News

  • Version 0.7.0 released
  • Version 0.6.1 released
  • Version 0.6.0 released

All libraries

  • Symbol index
  • compiler/helpers
  • compiler
  • compiler/nodes
  • compiler/optimise
  • compiler/pass
  • compiler/pattern
  • compiler/resolve
  • control/comparison
  • control/prompt
  • control/setq
  • core/base
  • core/binders
  • core/demand
  • core/list
  • core/match
  • core/method
  • core/prelude
  • core/string
  • core/symbol
  • core/table
  • core/type
  • data/alist
  • data/bitset
  • data/format
  • data/function
  • data/graph
  • data/set
  • data/struct
  • io/argparse
  • io/foreign
  • io
  • io/term
  • lua/basic
  • lua/bit32
  • lua/coroutine
  • lua/debug
  • lua/io
  • lua/math
  • lua/os
  • lua/package
  • lua/string
  • lua/table
  • lua/utf8
  • luajit/bit
  • luajit/ffi
  • luajit/jit
  • math/bignum
  • math/bit32
  • math/complex
  • math
  • math/matrix
  • math/numerics
  • math/rational
  • math/vector
  • prelude
  • test/assert
  • test/check
  • test
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.