unimsg provisional

examples/solar-system.umsg

%unimsg 0 astronomy/solar-system/v1 · 178 lines · 8927 bytes of text · 6356 bytes canonical · the raw file

Point at anything below — a sigil, a literal, a brace — and the card says what it is. Keyboard: tab through the document. Every explanation is also printed in full beneath the source.

%unimsg 0 astronomy/solar-system/v1

-- The planets of the solar system: what they are, and where they will be.
--
-- The second half of that sentence is why this document exists. Positions are
-- not stored here and could not be: a position is a function of time, and
-- there are infinitely many times. What is stored is the orbit — six numbers
-- per body — together with the procedure that turns six numbers and an instant
-- into a place.
--
-- That is the oldest idea in this project and the first document to use it. A
-- document need not contain an answer if it contains the formula and the
-- arguments. The reader supplies a machine; the document supplies the rule.
-- Nothing here is executed by reading it, and nothing needs to be: the
-- procedure is inert data until something chooses to act on it.

solar-system @sol/v1 {
  title  "Orbital elements and physical properties of the eight planets"
  centre "the Sun"
  frame  "heliocentric, J2000 ecliptic"

  provenance {
    elements-from "JPL approximate orbital elements, epoch J2000"
    valid-over    "1800 to 2050"
    accuracy      "Approximate by construction: these are mean elements fitted
                   for a two-century window, not an ephemeris. Positions
                   computed from them are good to arcminutes for the inner
                   planets and worse for the outer ones."
    why-that-is-fine "The document is a demonstration that a formula can
                      travel with its arguments. An ephemeris would be a larger
                      table and the same idea."
    precision-note "Values are given to the precision the source publishes.
                    Trailing digits are not padded, because in this format a
                    trailing zero is a claim about significance."
  }

  -- ===================================================================
  -- THE ORBITS
  -- ===================================================================

  -- Six elements fix an orbit; the seventh column is the period, which is
  -- implied by the first but published alongside it and kept here so the
  -- document can check itself further down.
  elements [
    | body                a-au           e     incl-deg      node-deg      peri-long-deg     mean-long-deg   period-days
    | "Mercury"   0.38709927  0.20563593    7.004979   48.33076593   77.45779628  252.25032350      87.969
    | "Venus"     0.72333566  0.00677672    3.394676   76.67984255  131.60246718  181.97909950     224.701
    | "Earth"     1.00000261  0.01671123   -0.000015    0.00000000  102.93768193  100.46457166     365.256
    | "Mars"      1.52371034  0.09339410    1.849691   49.55953891  -23.94362959   -4.55343205     686.980
    | "Jupiter"   5.20288700  0.04838624    1.304397  100.47390909   14.72847983   34.39644051    4332.589
    | "Saturn"    9.53667594  0.05386179    2.485992  113.66242448   92.59887831   49.95424423   10759.220
    | "Uranus"   19.18916464  0.04725744    0.772638   74.01692503  170.95427630  313.23810451   30685.400
    | "Neptune"  30.06992276  0.00859048    1.770043  131.78422574   44.96476227  -55.12002969   60189.000
  ]

  units {
    a-au          "astronomical units"
    e             "dimensionless"
    incl-deg      "degrees from the ecliptic"
    node-deg      "degrees, longitude of the ascending node"
    peri-long-deg "degrees, longitude of perihelion"
    mean-long-deg "degrees, mean longitude at the epoch"
    period-days   "days"
  }

  -- ===================================================================
  -- THE BODIES
  -- ===================================================================

  physical [
    | body            mass-kg  radius-km  rotation-days  axial-tilt-deg
    | "Mercury"   3.3011e23     2439.7   58.64600     0.03
    | "Venus"     4.8675e24     6051.8 -243.02500   177.36
    | "Earth"     5.9724e24     6378.1    0.99727    23.44
    | "Mars"      6.4171e23     3396.2    1.02596    25.19
    | "Jupiter"   1.8982e27    71492.0    0.41354     3.13
    | "Saturn"    5.6834e26    60268.0    0.44401    26.73
    | "Uranus"     8.681e25    25559.0   -0.71833    97.77
    | "Neptune"   1.0241e26    24764.0    0.67125    28.32
  ]

  physical-units {
    mass-kg        "kilograms"
    radius-km      "equatorial radius, kilometres"
    rotation-days  "sidereal rotation period; negative is retrograde"
    axial-tilt-deg "degrees"
  }

  retrograde-note "Venus and Uranus carry negative rotation periods. The sign
                   is the datum, not a formatting accident — they turn the
                   other way."

  -- ===================================================================
  -- WHERE A PLANET IS
  -- ===================================================================

  -- The generator. Given a body's elements and an instant, these steps yield a
  -- heliocentric position. They are written as data: a reader that has sine,
  -- cosine and a loop can carry them out, and one that has not can still read
  -- and present them.
  --
  -- Nothing is resolved at read time. This block is a description of a
  -- computation, not a computation.

  position-of !formula/procedure {
    yields  "heliocentric ecliptic coordinates, in astronomical units"
    given   [ "a row of `elements`", "an instant, as days from J2000" ]
    needs   [ :sin, :cos, :sqrt, :atan2, :iteration ]

    steps [
      | n  name                 rule
      | 1  "mean anomaly"       "M = mean-long-deg + 360 x t / period-days - peri-long-deg, reduced to [-180, 180)"
      | 2  "eccentric anomaly"  "solve M = E - e x sin(E) for E"
      | 3  "in-plane position"  "x = a x (cos(E) - e);  y = a x sqrt(1 - e^2) x sin(E)"
      | 4  "to the ecliptic"    "rotate x and y by the argument of perihelion, then the inclination, then the node"
  ]

    solving-step-2 {
      method     :newton-raphson
      iteration  "E' = E - (E - e x sin(E) - M) / (1 - e x cos(E))"
      start-from "E = M"
      until      "the change is smaller than the precision wanted"
      why-iterate "Kepler's equation has no closed-form solution in elementary
                   functions. That is a property of the problem, and a document
                   that pretended otherwise would be encoding a wish."
      terminates "For e < 1 the iteration converges, and every orbit here has
                  e below 0.21. A reader should still bound it: a document is
                  not trusted to terminate, and this one is only asserting that
                  it does."
    }

    what-this-is-not "An ephemeris. Perturbations between planets are ignored,
                      so this is a two-body approximation per planet — good
                      enough to place a dot on a diagram, not to aim anything."
  }

  -- ===================================================================
  -- THE DOCUMENT CHECKING ITSELF
  -- ===================================================================

  -- Kepler's third law relates the two columns that were given independently,
  -- so the document carries a test of its own data rather than asking to be
  -- believed. A reader that can multiply can verify the table it was handed.
  self-check !formula/assertion {
    law       "Kepler's third: the square of the period is proportional to the
               cube of the semi-major axis"
    predicate "(period-days / 365.256) ^ 2 / a-au ^ 3 = 1, within 0.002"
    holds-for :every-row
    measured  "1.0000 for the four inner planets; 0.9987 to 1.0004 for the
               outer four, the drift being the mean elements rather than the
               physics"
    why-here "A table of numbers is an assertion. A table of numbers with a law
              they must satisfy is a checkable one, and this format is meant to
              carry the second kind."
  }

  -- ===================================================================
  -- WHAT A GENERIC STORE CAN AND CANNOT DO WITH THIS
  -- ===================================================================

  ordering-note {
    can "Order bodies by any single published quantity — mass, radius, period,
         distance — by giving a descriptor with a numeric ordering and a path
         to the column. The store needs no knowledge of astronomy to do it."

    cannot "Order bodies by computed position. The store's formula grammar has
            arithmetic and no trigonometry, and no iteration, so Kepler's
            equation is outside it — deliberately. A grammar that could express
            step 2 would be a programming language, and the store would be
            running it during a write."

    the-shape-of-that "The same boundary the presentation surface has: a reader
                       acts on what arrives at a level it can already act on.
                       Elements are such a level for ordering by mass, and are
                       not for ordering by position."
  }
}

The canonical encoding

Produced by the reference encoder when this page was built. Decoding these bytes and printing them in the text form returns the document above, byte for byte — that round trip is the claim the whole format rests on.

a1 6c 73 6f 6c 61 72 2d 73 79 73 74 65 6d da 00 01 11 d5 82 81 da 00 01
11 d6 66 73 6f 6c 2f 76 31 ac 65 66 72 61 6d 65 78 1c 68 65 6c 69 6f 63
65 6e 74 72 69 63 2c 20 4a 32 30 30 30 20 65 63 6c 69 70 74 69 63 65 74
69 74 6c 65 78 3d 4f 72 62 69 74 61 6c 20 65 6c 65 6d 65 6e 74 73 20 61
6e 64 20 70 68 79 73 69 63 61 6c 20 70 72 6f 70 65 72 74 69 65 73 20 6f
66 20 74 68 65 20 65 69 67 68 74 20 70 6c 61 6e 65 74 73 65 75 6e 69 74
73 a7 61 65 6d 64 69 6d 65 6e 73 69 6f 6e 6c 65 73 73 64 61 2d 61 75 72
61 73 74 72 6f 6e 6f 6d 69 63 61 6c 20 75 6e 69 74 73 68 69 6e 63 6c 2d
64 65 67 78 19 64 65 67 72 65 65 73 20 66 72 6f 6d 20 74 68 65 20 65 63
6c 69 70 74 69 63 68 6e 6f 64 65 2d 64 65 67 78 28 64 65 67 72 65 65 73
2c 20 6c 6f 6e 67 69 74 75 64 65 20 6f 66 20 74 68 65 20 61 73 63 65 6e
64 69 6e 67 20 6e 6f 64 65 6b 70 65 72 69 6f 64 2d 64 61 79 73 64 64 61
79 73 6d 6d 65 61 6e 2d 6c 6f 6e 67 2d 64 65 67 78 24 64 65 67 72 65 65
73 2c 20 6d 65 61 6e 20 6c 6f 6e 67 69 74 75 64 65 20 61 74 20 74 68 65
20 65 70 6f 63 68 6d 70 65 72 69 2d 6c 6f 6e 67 2d 64 65 67 78 20 64 65
67 72 65 65 73 2c 20 6c 6f 6e 67 69 74 75 64 65 20 6f 66 20 70 65 72 69
68 65 6c 69 6f 6e 66 63 65 6e 74 72 65 67 74 68 65 20 53 75 6e 68 65 6c
65 6d 65 6e 74 73 88 a8 61 65 c4 82 27 1a 01 39 c6 89 64 61 2d 61 75 c4
82 27 1a 02 4e aa a7 64 62 6f 64 79 67 4d 65 72 63 75 72 79 68 69 6e 63
6c 2d 64 65 67 c4 82 25 1a 00 6a e3 33 68 6e 6f 64 65 2d 64 65 67 c4 82
27 1b 00 00 00 01 20 12 e5 71 6b 70 65 72 69 6f 64 2d 64 61 79 73 c4 82
22 1a 00 01 57 a1 6d 6d 65 61 6e 2d 6c 6f 6e 67 2d 64 65 67 c4 82 27 1b
00 00 00 05 df 87 72 9e 6d 70 65 72 69 2d 6c 6f 6e 67 2d 64 65 67 c4 82
27 1b 00 00 00 01 cd af 37 ac a8 61 65 c4 82 27 1a 00 0a 57 28 64 61 2d
61 75 c4 82 27 1a 04 4f b8 fe 64 62 6f 64 79 65 56 65 6e 75 73 68 69 6e
63 6c 2d 64 65 67 c4 82 25 1a 00 33 cc 74 68 6e 6f 64 65 2d 64 65 67 c4
82 27 1b 00 00 00 01 c9 0c 27 7f 6b 70 65 72 69 6f 64 2d 64 61 79 73 c4
82 22 1a 00 03 6d bd 6d 6d 65 61 6e 2d 6c 6f 6e 67 2d 64 65 67 c4 82 27
1b 00 00 00 04 3c ae 11 be 6d 70 65 72 69 2d 6c 6f 6e 67 2d 64 65 67 c4
82 27 1b 00 00 00 03 10 69 6d be a8 61 65 c4 82 27 1a 00 19 7f d3 64 61
2d 61 75 c4 82 27 1a 05 f5 e2 05 64 62 6f 64 79 65 45 61 72 74 68 68 69
6e 63 6c 2d 64 65 67 c4 82 25 2e 68 6e 6f 64 65 2d 64 65 67 c4 82 27 00
6b 70 65 72 69 6f 64 2d 64 61 79 73 c4 82 22 1a 00 05 92 c8 6d 6d 65 61
6e 2d 6c 6f 6e 67 2d 64 65 67 c4 82 27 1b 00 00 00 02 56 d0 c5 4e 6d 70
65 72 69 2d 6c 6f 6e 67 2d 64 65 67 c4 82 27 1b 00 00 00 02 65 8e 70 01
a8 61 65 c4 82 27 1a 00 8e 82 12 64 61 2d 61 75 c4 82 27 1a 09 14 ff 5a
64 62 6f 64 79 64 4d 61 72 73 68 69 6e 63 6c 2d 64 65 67 c4 82 25 1a 00
1c 39 5b 68 6e 6f 64 65 2d 64 65 67 c4 82 27 1b 00 00 00 01 27 65 da e3
6b 70 65 72 69 6f 64 2d 64 61 79 73 c4 82 22 1a 00 0a 7b 84 6d 6d 65 61
6e 2d 6c 6f 6e 67 2d 64 65 67 c4 82 27 3a 1b 23 fc 64 6d 70 65 72 69 2d
6c 6f 6e 67 2d 64 65 67 c4 82 27 3a 8e b7 14 4e a8 61 65 c4 82 27 1a 00
49 d4 e0 64 61 2d 61 75 c4 82 27 1a 1f 02 f9 bc 64 62 6f 64 79 67 4a 75
70 69 74 65 72 68 69 6e 63 6c 2d 64 65 67 c4 82 25 1a 00 13 e7 4d 68 6e
6f 64 65 2d 64 65 67 c4 82 27 1b 00 00 00 02 56 df 04 bd 6b 70 65 72 69
6f 64 2d 64 61 79 73 c4 82 22 1a 00 42 1c 2d 6d 6d 65 61 6e 2d 6c 6f 6e
67 2d 64 65 67 c4 82 27 1a cd 04 cd 93 6d 70 65 72 69 2d 6c 6f 6e 67 2d
64 65 67 c4 82 27 1a 57 c9 e0 6f a8 61 65 c4 82 27 1a 00 52 2f c3 64 61
2d 61 75 c4 82 27 1a 38 d7 d0 0a 64 62 6f 64 79 66 53 61 74 75 72 6e 68
69 6e 63 6c 2d 64 65 67 c4 82 25 1a 00 25 ee e8 68 6e 6f 64 65 2d 64 65
67 c4 82 27 1b 00 00 00 02 a5 7b 18 90 6b 70 65 72 69 6f 64 2d 64 61 79
73 c4 82 22 1a 00 a4 2c 34 6d 6d 65 61 6e 2d 6c 6f 6e 67 2d 64 65 67 c4
82 27 1b 00 00 00 01 29 c0 20 a7 6d 70 65 72 69 2d 6c 6f 6e 67 2d 64 65
67 c4 82 27 1b 00 00 00 02 27 ee ac d7 a8 61 65 c4 82 27 1a 00 48 1b f0
64 61 2d 61 75 c4 82 27 1a 72 60 57 70 64 62 6f 64 79 66 55 72 61 6e 75
73 68 69 6e 63 6c 2d 64 65 67 c4 82 25 1a 00 0b ca 1e 68 6e 6f 64 65 2d
64 65 67 c4 82 27 1b 00 00 00 01 b9 2c dd 57 6b 70 65 72 69 6f 64 2d 64
61 79 73 c4 82 22 1a 01 d4 38 d8 6d 6d 65 61 6e 2d 6c 6f 6e 67 2d 64 65
67 c4 82 27 1b 00 00 00 07 4b 0b 6a 93 6d 70 65 72 69 2d 6c 6f 6e 67 2d
64 65 67 c4 82 27 1b 00 00 00 03 fa f7 86 2e a8 61 65 c4 82 27 1a 00 0d
1b a8 64 61 2d 61 75 c4 82 27 1a b3 3b 0f 94 64 62 6f 64 79 67 4e 65 70
74 75 6e 65 68 69 6e 63 6c 2d 64 65 67 c4 82 25 1a 00 1b 02 3b 68 6e 6f
64 65 2d 64 65 67 c4 82 27 1b 00 00 00 03 11 7e c5 2e 6b 70 65 72 69 6f
64 2d 64 61 79 73 c4 82 22 1a 03 96 69 48 6d 6d 65 61 6e 2d 6c 6f 6e 67
2d 64 65 67 c4 82 27 3b 00 00 00 01 48 8a 7d 98 6d 70 65 72 69 2d 6c 6f
6e 67 2d 64 65 67 c4 82 27 1b 00 00 00 01 0c 02 c8 43 68 70 68 79 73 69
63 61 6c 88 a5 64 62 6f 64 79 67 4d 65 72 63 75 72 79 67 6d 61 73 73 2d
6b 67 c4 82 13 19 80 f3 69 72 61 64 69 75 73 2d 6b 6d c4 82 20 19 5f 4d
6d 72 6f 74 61 74 69 6f 6e 2d 64 61 79 73 c4 82 24 1a 00 59 7c 98 6e 61
78 69 61 6c 2d 74 69 6c 74 2d 64 65 67 c4 82 21 03 a5 64 62 6f 64 79 65
56 65 6e 75 73 67 6d 61 73 73 2d 6b 67 c4 82 14 19 be 23 69 72 61 64 69
75 73 2d 6b 6d c4 82 20 19 ec 66 6d 72 6f 74 61 74 69 6f 6e 2d 64 61 79
73 c4 82 24 3a 01 72 d3 a3 6e 61 78 69 61 6c 2d 74 69 6c 74 2d 64 65 67
c4 82 21 19 45 48 a5 64 62 6f 64 79 65 45 61 72 74 68 67 6d 61 73 73 2d
6b 67 c4 82 14 19 e9 4c 69 72 61 64 69 75 73 2d 6b 6d c4 82 20 19 f9 25
6d 72 6f 74 61 74 69 6f 6e 2d 64 61 79 73 c4 82 24 1a 00 01 85 8f 6e 61
78 69 61 6c 2d 74 69 6c 74 2d 64 65 67 c4 82 21 19 09 28 a5 64 62 6f 64
79 64 4d 61 72 73 67 6d 61 73 73 2d 6b 67 c4 82 13 19 fa ab 69 72 61 64
69 75 73 2d 6b 6d c4 82 20 19 84 aa 6d 72 6f 74 61 74 69 6f 6e 2d 64 61
79 73 c4 82 24 1a 00 01 90 c4 6e 61 78 69 61 6c 2d 74 69 6c 74 2d 64 65
67 c4 82 21 19 09 d7 a5 64 62 6f 64 79 67 4a 75 70 69 74 65 72 67 6d 61
73 73 2d 6b 67 c4 82 17 19 4a 26 69 72 61 64 69 75 73 2d 6b 6d c4 82 20
1a 00 0a e8 a8 6d 72 6f 74 61 74 69 6f 6e 2d 64 61 79 73 c4 82 24 19 a1
8a 6e 61 78 69 61 6c 2d 74 69 6c 74 2d 64 65 67 c4 82 21 19 01 39 a5 64
62 6f 64 79 66 53 61 74 75 72 6e 67 6d 61 73 73 2d 6b 67 c4 82 16 19 de
02 69 72 61 64 69 75 73 2d 6b 6d c4 82 20 1a 00 09 32 38 6d 72 6f 74 61
74 69 6f 6e 2d 64 61 79 73 c4 82 24 19 ad 71 6e 61 78 69 61 6c 2d 74 69
6c 74 2d 64 65 67 c4 82 21 19 0a 71 a5 64 62 6f 64 79 66 55 72 61 6e 75
73 67 6d 61 73 73 2d 6b 67 c4 82 16 19 21 e9 69 72 61 64 69 75 73 2d 6b
6d c4 82 20 1a 00 03 e6 66 6d 72 6f 74 61 74 69 6f 6e 2d 64 61 79 73 c4
82 24 3a 00 01 18 98 6e 61 78 69 61 6c 2d 74 69 6c 74 2d 64 65 67 c4 82
21 19 26 31 a5 64 62 6f 64 79 67 4e 65 70 74 75 6e 65 67 6d 61 73 73 2d
6b 67 c4 82 16 19 28 01 69 72 61 64 69 75 73 2d 6b 6d c4 82 20 1a 00 03
c7 58 6d 72 6f 74 61 74 69 6f 6e 2d 64 61 79 73 c4 82 24 1a 00 01 06 35
6e 61 78 69 61 6c 2d 74 69 6c 74 2d 64 65 67 c4 82 21 19 0b 10 6a 70 72
6f 76 65 6e 61 6e 63 65 a5 68 61 63 63 75 72 61 63 79 79 01 08 41 70 70
72 6f 78 69 6d 61 74 65 20 62 79 20 63 6f 6e 73 74 72 75 63 74 69 6f 6e
3a 20 74 68 65 73 65 20 61 72 65 20 6d 65 61 6e 20 65 6c 65 6d 65 6e 74
73 20 66 69 74 74 65 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
20 20 20 20 66 6f 72 20 61 20 74 77 6f 2d 63 65 6e 74 75 72 79 20 77 69
6e 64 6f 77 2c 20 6e 6f 74 20 61 6e 20 65 70 68 65 6d 65 72 69 73 2e 20
50 6f 73 69 74 69 6f 6e 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20
20 20 20 20 20 63 6f 6d 70 75 74 65 64 20 66 72 6f 6d 20 74 68 65 6d 20
61 72 65 20 67 6f 6f 64 20 74 6f 20 61 72 63 6d 69 6e 75 74 65 73 20 66
6f 72 20 74 68 65 20 69 6e 6e 65 72 0a 20 20 20 20 20 20 20 20 20 20 20
20 20 20 20 20 20 20 20 70 6c 61 6e 65 74 73 20 61 6e 64 20 77 6f 72 73
65 20 66 6f 72 20 74 68 65 20 6f 75 74 65 72 20 6f 6e 65 73 2e 6a 76 61
6c 69 64 2d 6f 76 65 72 6c 31 38 30 30 20 74 6f 20 32 30 35 30 6d 65 6c
65 6d 65 6e 74 73 2d 66 72 6f 6d 78 2d 4a 50 4c 20 61 70 70 72 6f 78 69
6d 61 74 65 20 6f 72 62 69 74 61 6c 20 65 6c 65 6d 65 6e 74 73 2c 20 65
70 6f 63 68 20 4a 32 30 30 30 6e 70 72 65 63 69 73 69 6f 6e 2d 6e 6f 74
65 78 c5 56 61 6c 75 65 73 20 61 72 65 20 67 69 76 65 6e 20 74 6f 20 74
68 65 20 70 72 65 63 69 73 69 6f 6e 20 74 68 65 20 73 6f 75 72 63 65 20
70 75 62 6c 69 73 68 65 73 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20
20 20 20 20 20 20 20 54 72 61 69 6c 69 6e 67 20 64 69 67 69 74 73 20 61
72 65 20 6e 6f 74 20 70 61 64 64 65 64 2c 20 62 65 63 61 75 73 65 20 69
6e 20 74 68 69 73 20 66 6f 72 6d 61 74 20 61 0a 20 20 20 20 20 20 20 20
20 20 20 20 20 20 20 20 20 20 20 20 74 72 61 69 6c 69 6e 67 20 7a 65 72
6f 20 69 73 20 61 20 63 6c 61 69 6d 20 61 62 6f 75 74 20 73 69 67 6e 69
66 69 63 61 6e 63 65 2e 70 77 68 79 2d 74 68 61 74 2d 69 73 2d 66 69 6e
65 78 b1 54 68 65 20 64 6f 63 75 6d 65 6e 74 20 69 73 20 61 20 64 65 6d
6f 6e 73 74 72 61 74 69 6f 6e 20 74 68 61 74 20 61 20 66 6f 72 6d 75 6c
61 20 63 61 6e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
20 20 20 20 74 72 61 76 65 6c 20 77 69 74 68 20 69 74 73 20 61 72 67 75
6d 65 6e 74 73 2e 20 41 6e 20 65 70 68 65 6d 65 72 69 73 20 77 6f 75 6c
64 20 62 65 20 61 20 6c 61 72 67 65 72 0a 20 20 20 20 20 20 20 20 20 20
20 20 20 20 20 20 20 20 20 20 20 20 74 61 62 6c 65 20 61 6e 64 20 74 68
65 20 73 61 6d 65 20 69 64 65 61 2e 6a 73 65 6c 66 2d 63 68 65 63 6b da
00 01 11 d9 82 71 66 6f 72 6d 75 6c 61 2f 61 73 73 65 72 74 69 6f 6e a5
63 6c 61 77 78 6a 4b 65 70 6c 65 72 27 73 20 74 68 69 72 64 3a 20 74 68
65 20 73 71 75 61 72 65 20 6f 66 20 74 68 65 20 70 65 72 69 6f 64 20 69
73 20 70 72 6f 70 6f 72 74 69 6f 6e 61 6c 20 74 6f 20 74 68 65 0a 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 63 75 62 65 20 6f 66 20 74 68 65
20 73 65 6d 69 2d 6d 61 6a 6f 72 20 61 78 69 73 68 6d 65 61 73 75 72 65
64 78 9f 31 2e 30 30 30 30 20 66 6f 72 20 74 68 65 20 66 6f 75 72 20 69
6e 6e 65 72 20 70 6c 61 6e 65 74 73 3b 20 30 2e 39 39 38 37 20 74 6f 20
31 2e 30 30 30 34 20 66 6f 72 20 74 68 65 0a 20 20 20 20 20 20 20 20 20
20 20 20 20 20 20 6f 75 74 65 72 20 66 6f 75 72 2c 20 74 68 65 20 64 72
69 66 74 20 62 65 69 6e 67 20 74 68 65 20 6d 65 61 6e 20 65 6c 65 6d 65
6e 74 73 20 72 61 74 68 65 72 20 74 68 61 6e 20 74 68 65 0a 20 20 20 20
20 20 20 20 20 20 20 20 20 20 20 70 68 79 73 69 63 73 68 77 68 79 2d 68
65 72 65 78 b6 41 20 74 61 62 6c 65 20 6f 66 20 6e 75 6d 62 65 72 73 20
69 73 20 61 6e 20 61 73 73 65 72 74 69 6f 6e 2e 20 41 20 74 61 62 6c 65
20 6f 66 20 6e 75 6d 62 65 72 73 20 77 69 74 68 20 61 20 6c 61 77 0a 20
20 20 20 20 20 20 20 20 20 20 20 20 20 74 68 65 79 20 6d 75 73 74 20 73
61 74 69 73 66 79 20 69 73 20 61 20 63 68 65 63 6b 61 62 6c 65 20 6f 6e
65 2c 20 61 6e 64 20 74 68 69 73 20 66 6f 72 6d 61 74 20 69 73 20 6d 65
61 6e 74 20 74 6f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 61 72
72 79 20 74 68 65 20 73 65 63 6f 6e 64 20 6b 69 6e 64 2e 69 68 6f 6c 64
73 2d 66 6f 72 da 00 01 11 d4 69 65 76 65 72 79 2d 72 6f 77 69 70 72 65
64 69 63 61 74 65 78 38 28 70 65 72 69 6f 64 2d 64 61 79 73 20 2f 20 33
36 35 2e 32 35 36 29 20 5e 20 32 20 2f 20 61 2d 61 75 20 5e 20 33 20 3d
20 31 2c 20 77 69 74 68 69 6e 20 30 2e 30 30 32 6b 70 6f 73 69 74 69 6f
6e 2d 6f 66 da 00 01 11 d9 82 71 66 6f 72 6d 75 6c 61 2f 70 72 6f 63 65
64 75 72 65 a6 65 67 69 76 65 6e 82 73 61 20 72 6f 77 20 6f 66 20 60 65
6c 65 6d 65 6e 74 73 60 78 1e 61 6e 20 69 6e 73 74 61 6e 74 2c 20 61 73
20 64 61 79 73 20 66 72 6f 6d 20 4a 32 30 30 30 65 6e 65 65 64 73 85 da
00 01 11 d4 63 73 69 6e da 00 01 11 d4 63 63 6f 73 da 00 01 11 d4 64 73
71 72 74 da 00 01 11 d4 65 61 74 61 6e 32 da 00 01 11 d4 69 69 74 65 72
61 74 69 6f 6e 65 73 74 65 70 73 84 a3 61 6e 01 64 6e 61 6d 65 6c 6d 65
61 6e 20 61 6e 6f 6d 61 6c 79 64 72 75 6c 65 78 51 4d 20 3d 20 6d 65 61
6e 2d 6c 6f 6e 67 2d 64 65 67 20 2b 20 33 36 30 20 78 20 74 20 2f 20 70
65 72 69 6f 64 2d 64 61 79 73 20 2d 20 70 65 72 69 2d 6c 6f 6e 67 2d 64
65 67 2c 20 72 65 64 75 63 65 64 20 74 6f 20 5b 2d 31 38 30 2c 20 31 38
30 29 a3 61 6e 02 64 6e 61 6d 65 71 65 63 63 65 6e 74 72 69 63 20 61 6e
6f 6d 61 6c 79 64 72 75 6c 65 78 1e 73 6f 6c 76 65 20 4d 20 3d 20 45 20
2d 20 65 20 78 20 73 69 6e 28 45 29 20 66 6f 72 20 45 a3 61 6e 03 64 6e
61 6d 65 71 69 6e 2d 70 6c 61 6e 65 20 70 6f 73 69 74 69 6f 6e 64 72 75
6c 65 78 35 78 20 3d 20 61 20 78 20 28 63 6f 73 28 45 29 20 2d 20 65 29
3b 20 20 79 20 3d 20 61 20 78 20 73 71 72 74 28 31 20 2d 20 65 5e 32 29
20 78 20 73 69 6e 28 45 29 a3 61 6e 04 64 6e 61 6d 65 6f 74 6f 20 74 68
65 20 65 63 6c 69 70 74 69 63 64 72 75 6c 65 78 51 72 6f 74 61 74 65 20
78 20 61 6e 64 20 79 20 62 79 20 74 68 65 20 61 72 67 75 6d 65 6e 74 20
6f 66 20 70 65 72 69 68 65 6c 69 6f 6e 2c 20 74 68 65 6e 20 74 68 65 20
69 6e 63 6c 69 6e 61 74 69 6f 6e 2c 20 74 68 65 6e 20 74 68 65 20 6e 6f
64 65 66 79 69 65 6c 64 73 78 38 68 65 6c 69 6f 63 65 6e 74 72 69 63 20
65 63 6c 69 70 74 69 63 20 63 6f 6f 72 64 69 6e 61 74 65 73 2c 20 69 6e
20 61 73 74 72 6f 6e 6f 6d 69 63 61 6c 20 75 6e 69 74 73 6e 73 6f 6c 76
69 6e 67 2d 73 74 65 70 2d 32 a6 65 75 6e 74 69 6c 78 2f 74 68 65 20 63
68 61 6e 67 65 20 69 73 20 73 6d 61 6c 6c 65 72 20 74 68 61 6e 20 74 68
65 20 70 72 65 63 69 73 69 6f 6e 20 77 61 6e 74 65 64 66 6d 65 74 68 6f
64 da 00 01 11 d4 6e 6e 65 77 74 6f 6e 2d 72 61 70 68 73 6f 6e 69 69 74
65 72 61 74 69 6f 6e 78 30 45 27 20 3d 20 45 20 2d 20 28 45 20 2d 20 65
20 78 20 73 69 6e 28 45 29 20 2d 20 4d 29 20 2f 20 28 31 20 2d 20 65 20
78 20 63 6f 73 28 45 29 29 6a 73 74 61 72 74 2d 66 72 6f 6d 65 45 20 3d
20 4d 6a 74 65 72 6d 69 6e 61 74 65 73 78 f4 46 6f 72 20 65 20 3c 20 31
20 74 68 65 20 69 74 65 72 61 74 69 6f 6e 20 63 6f 6e 76 65 72 67 65 73
2c 20 61 6e 64 20 65 76 65 72 79 20 6f 72 62 69 74 20 68 65 72 65 20 68
61 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 65 20 62
65 6c 6f 77 20 30 2e 32 31 2e 20 41 20 72 65 61 64 65 72 20 73 68 6f 75
6c 64 20 73 74 69 6c 6c 20 62 6f 75 6e 64 20 69 74 3a 20 61 20 64 6f 63
75 6d 65 6e 74 20 69 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
20 20 20 6e 6f 74 20 74 72 75 73 74 65 64 20 74 6f 20 74 65 72 6d 69 6e
61 74 65 2c 20 61 6e 64 20 74 68 69 73 20 6f 6e 65 20 69 73 20 6f 6e 6c
79 20 61 73 73 65 72 74 69 6e 67 20 74 68 61 74 0a 20 20 20 20 20 20 20
20 20 20 20 20 20 20 20 20 20 20 69 74 20 64 6f 65 73 2e 6b 77 68 79 2d
69 74 65 72 61 74 65 78 d1 4b 65 70 6c 65 72 27 73 20 65 71 75 61 74 69
6f 6e 20 68 61 73 20 6e 6f 20 63 6c 6f 73 65 64 2d 66 6f 72 6d 20 73 6f
6c 75 74 69 6f 6e 20 69 6e 20 65 6c 65 6d 65 6e 74 61 72 79 0a 20 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 75 6e 63 74 69 6f 6e
73 2e 20 54 68 61 74 20 69 73 20 61 20 70 72 6f 70 65 72 74 79 20 6f 66
20 74 68 65 20 70 72 6f 62 6c 65 6d 2c 20 61 6e 64 20 61 20 64 6f 63 75
6d 65 6e 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
74 68 61 74 20 70 72 65 74 65 6e 64 65 64 20 6f 74 68 65 72 77 69 73 65
20 77 6f 75 6c 64 20 62 65 20 65 6e 63 6f 64 69 6e 67 20 61 20 77 69 73
68 2e 70 77 68 61 74 2d 74 68 69 73 2d 69 73 2d 6e 6f 74 78 d5 41 6e 20
65 70 68 65 6d 65 72 69 73 2e 20 50 65 72 74 75 72 62 61 74 69 6f 6e 73
20 62 65 74 77 65 65 6e 20 70 6c 61 6e 65 74 73 20 61 72 65 20 69 67 6e
6f 72 65 64 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
20 20 20 20 73 6f 20 74 68 69 73 20 69 73 20 61 20 74 77 6f 2d 62 6f 64
79 20 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 20 70 65 72 20 70 6c 61 6e
65 74 20 e2 80 94 20 67 6f 6f 64 0a 20 20 20 20 20 20 20 20 20 20 20 20
20 20 20 20 20 20 20 20 20 20 65 6e 6f 75 67 68 20 74 6f 20 70 6c 61 63
65 20 61 20 64 6f 74 20 6f 6e 20 61 20 64 69 61 67 72 61 6d 2c 20 6e 6f
74 20 74 6f 20 61 69 6d 20 61 6e 79 74 68 69 6e 67 2e 6d 6f 72 64 65 72
69 6e 67 2d 6e 6f 74 65 a3 63 63 61 6e 78 e3 4f 72 64 65 72 20 62 6f 64
69 65 73 20 62 79 20 61 6e 79 20 73 69 6e 67 6c 65 20 70 75 62 6c 69 73
68 65 64 20 71 75 61 6e 74 69 74 79 20 e2 80 94 20 6d 61 73 73 2c 20 72
61 64 69 75 73 2c 20 70 65 72 69 6f 64 2c 0a 20 20 20 20 20 20 20 20 20
64 69 73 74 61 6e 63 65 20 e2 80 94 20 62 79 20 67 69 76 69 6e 67 20 61
20 64 65 73 63 72 69 70 74 6f 72 20 77 69 74 68 20 61 20 6e 75 6d 65 72
69 63 20 6f 72 64 65 72 69 6e 67 20 61 6e 64 20 61 20 70 61 74 68 0a 20
20 20 20 20 20 20 20 20 74 6f 20 74 68 65 20 63 6f 6c 75 6d 6e 2e 20 54
68 65 20 73 74 6f 72 65 20 6e 65 65 64 73 20 6e 6f 20 6b 6e 6f 77 6c 65
64 67 65 20 6f 66 20 61 73 74 72 6f 6e 6f 6d 79 20 74 6f 20 64 6f 20 69
74 2e 66 63 61 6e 6e 6f 74 79 01 50 4f 72 64 65 72 20 62 6f 64 69 65 73
20 62 79 20 63 6f 6d 70 75 74 65 64 20 70 6f 73 69 74 69 6f 6e 2e 20 54
68 65 20 73 74 6f 72 65 27 73 20 66 6f 72 6d 75 6c 61 20 67 72 61 6d 6d
61 72 20 68 61 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 61 72 69 74 68
6d 65 74 69 63 20 61 6e 64 20 6e 6f 20 74 72 69 67 6f 6e 6f 6d 65 74 72
79 2c 20 61 6e 64 20 6e 6f 20 69 74 65 72 61 74 69 6f 6e 2c 20 73 6f 20
4b 65 70 6c 65 72 27 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 65 71 75
61 74 69 6f 6e 20 69 73 20 6f 75 74 73 69 64 65 20 69 74 20 e2 80 94 20
64 65 6c 69 62 65 72 61 74 65 6c 79 2e 20 41 20 67 72 61 6d 6d 61 72 20
74 68 61 74 20 63 6f 75 6c 64 20 65 78 70 72 65 73 73 0a 20 20 20 20 20
20 20 20 20 20 20 20 73 74 65 70 20 32 20 77 6f 75 6c 64 20 62 65 20 61
20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 2c 20 61
6e 64 20 74 68 65 20 73 74 6f 72 65 20 77 6f 75 6c 64 20 62 65 0a 20 20
20 20 20 20 20 20 20 20 20 20 72 75 6e 6e 69 6e 67 20 69 74 20 64 75 72
69 6e 67 20 61 20 77 72 69 74 65 2e 71 74 68 65 2d 73 68 61 70 65 2d 6f
66 2d 74 68 61 74 79 01 0a 54 68 65 20 73 61 6d 65 20 62 6f 75 6e 64 61
72 79 20 74 68 65 20 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 73 75 72 66
61 63 65 20 68 61 73 3a 20 61 20 72 65 61 64 65 72 0a 20 20 20 20 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 63 74 73 20 6f 6e
20 77 68 61 74 20 61 72 72 69 76 65 73 20 61 74 20 61 20 6c 65 76 65 6c
20 69 74 20 63 61 6e 20 61 6c 72 65 61 64 79 20 61 63 74 20 6f 6e 2e 0a
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 45
6c 65 6d 65 6e 74 73 20 61 72 65 20 73 75 63 68 20 61 20 6c 65 76 65 6c
20 66 6f 72 20 6f 72 64 65 72 69 6e 67 20 62 79 20 6d 61 73 73 2c 20 61
6e 64 20 61 72 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
20 20 20 20 20 20 6e 6f 74 20 66 6f 72 20 6f 72 64 65 72 69 6e 67 20 62
79 20 70 6f 73 69 74 69 6f 6e 2e 6e 70 68 79 73 69 63 61 6c 2d 75 6e 69
74 73 a4 67 6d 61 73 73 2d 6b 67 69 6b 69 6c 6f 67 72 61 6d 73 69 72 61
64 69 75 73 2d 6b 6d 78 1d 65 71 75 61 74 6f 72 69 61 6c 20 72 61 64 69
75 73 2c 20 6b 69 6c 6f 6d 65 74 72 65 73 6d 72 6f 74 61 74 69 6f 6e 2d
64 61 79 73 78 30 73 69 64 65 72 65 61 6c 20 72 6f 74 61 74 69 6f 6e 20
70 65 72 69 6f 64 3b 20 6e 65 67 61 74 69 76 65 20 69 73 20 72 65 74 72
6f 67 72 61 64 65 6e 61 78 69 61 6c 2d 74 69 6c 74 2d 64 65 67 67 64 65
67 72 65 65 73 6f 72 65 74 72 6f 67 72 61 64 65 2d 6e 6f 74 65 78 a5 56
65 6e 75 73 20 61 6e 64 20 55 72 61 6e 75 73 20 63 61 72 72 79 20 6e 65
67 61 74 69 76 65 20 72 6f 74 61 74 69 6f 6e 20 70 65 72 69 6f 64 73 2e
20 54 68 65 20 73 69 67 6e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20
20 20 20 20 20 69 73 20 74 68 65 20 64 61 74 75 6d 2c 20 6e 6f 74 20 61
20 66 6f 72 6d 61 74 74 69 6e 67 20 61 63 63 69 64 65 6e 74 20 e2 80 94
20 74 68 65 79 20 74 75 72 6e 20 74 68 65 0a 20 20 20 20 20 20 20 20 20
20 20 20 20 20 20 20 20 20 20 6f 74 68 65 72 20 77 61 79 2e
canonical CBOR for examples/solar-system.umsg 6356 bytes

Every construct on this page

The formal columns are read from the specification when this page is generated. The last column is this site's plain-language gloss and is not normative — where they differ, the specification is right.

constructglyphcarriesexamplegloss
:annotationA bare name qualifying the value after it—for example a language tag or a unit such as kg. It is not a value itself; a bare name with nothing after it is an error, not a guess.
:array^type, or type:shape; then [ elements ]^f64 [ 1.5, 2.5 ] or ^i16:2x3 [ … ]A packed, homogeneous numeric array. The ^ marker gives every element its type and may also give the row-major shape: ^f64:2x3 [ … ].
:array-elementOne element of a typed array. Its type comes from the ^ marker, so 1.5 inside ^f64 is binary64 rather than an exact decimal.
:array-missingA missing position in a typed array. null here is not an element value: it adds a validity mask while preserving the array's shape.
:blockA block: named pairs, in braces. Its keys are sorted in the encoding and shown here as written.
:bytes~encoding:data~hex:ff00 or ~b64:iVBORw0KGgo=Raw octets, carried as octets. No base64 tax, no pretending they are text.
:comment--to end of line-- a noteA note for people. It travels with the pair it precedes and never reaches the bytes.
:decimalAn exact decimal. 19.99 is nineteen and ninety-nine hundredths, not the nearest double to it.
:extension!name, then value!acme/hint { zone 4 }A qualifier this reader may not know. It survives the round trip intact, and stays legible on the way past — the rule that separates an extension from a private convention.
:floatA binary float, marked so it can never be mistaken for the exact decimal beside it.
:hash#algorithm:hex#sha256:deadbeefThe digest of some content, with the algorithm said out loud so it is still meaningful in ten years.
:header%unimsg only%unimsg 0 labelDeclares the format version and what this document is. Optional, and useful exactly when a file arrives without context.
:identifier@word@ord-88213Gives this value a name, so another document can point at it without copying it.
:integerA whole number of any size. Past 2^53 it is still exact, which is the whole reason this is not JSON.
:keyA field name: the first thing in a pair. It is bare when possible and quoted when needed, and names the content without becoming part of the value.
:reference->an identifier or a path-> @cust-4471, -> @lexicon.entries.kitābPoints at a name. Nothing follows it while reading — resolution is somebody else's job, deliberately.
:reserved-literalOne of six bare words that are values rather than names. The list is fixed, so no value is coerced by what it looks like.
:sequenceAn ordered list. Order is preserved and is meaning.
:stringText. May span lines, so prose does not have to be escaped into one.
:symbol:word:dispatchedA name from a fixed vocabulary, not free text. :high is a value someone chose; "high" is a phrase someone typed.
:table-row|cells| sku qtyOne record of a table. A table is sugar for a sequence of blocks with the same keys, and encodes identically to the longhand.
:timestampA temporal value at the precision written. 2026-08 stays a month, and 03:52 stays a wall-clock time; neither is widened into an invented instant.