Sandbox:Temp
This is a scratch page. You can do whatever to it below this line
Freedom begins under this line
This page demonstrates the instance's multi-line content capability: content items (quotations, math, code) can now hold genuinely multi-line payloads. Multi-line payloads are stored backslash-escaped — the wiki's string values reject raw line breaks — and decoded at render time. Everything below is live data: edit the item and this page updates by itself.
1. The multi-line item
Bernoulli numbers in Python is a code-snippet item whose payload is a real 12-line Python program — an Akiyama–Tanigawa computation of the Bernoulli numbers, echoing the algorithm Ada Lovelace sketched in her 1843 note. Earlier code items (e.g. Factorial in Python) were single-line only, squeezed onto one line; this one keeps its real shape.
| Kind | Item | Live data rendered from statements |
|---|---|---|
| Code snippet | Bernoulli numbers in Python | instance of: code snippet · language: Python · attributed to: Ada Lovelace · source: Notes by the Translator |
| Person | Ada Lovelace | instance of: person |
| Book (citable source) | Notes by the Translator | author: Ada Lovelace · publisher: R. & J. E. Taylor · year: 1843 |
2. How the payload is stored
The stored statement escapes each line break as a two-character \n sequence (and \t for tabs, \r for carriage returns, \\ for backslashes — backslashes first, so a literal \n inside the code survives the round trip). The {{#statements:}} parser function shows the raw, escaped value — one long line, exactly what storage holds:
from fractions import Fraction\n\ndef bernoulli(n):\n """Return the nth Bernoulli number (Akiyama-Tanigawa algorithm)."""\n A = [Fraction(0)] * (n + 1)\n for m in range(n + 1):\n A[m] = Fraction(1, m + 1)\n for j in range(m, 0, -1):\n A[j - 1] = j * (A[j - 1] - A[j])\n return A[0]\n\nprint([str(bernoulli(n)) for n in range(8)])
3. How it renders
The embed surface
The standalone embed decodes the payload — real line breaks, no escape sequences: rendered embed. (The sanitizer strips iframe tags from wiki pages, so on-wiki the reliable surface is this URL — which also feeds the citation auto-collect in § 4.)
On this page
The {{#content:}} parser function is the on-wiki decoder — it returns the same payload with the escapes undone:
from fractions import Fraction
def bernoulli(n):
"""Return the nth Bernoulli number (Akiyama-Tanigawa algorithm)."""
A = [Fraction(0)] * (n + 1)
for m in range(n + 1):
A[m] = Fraction(1, m + 1)
for j in range(m, 0, -1):
A[j - 1] = j * (A[j - 1] - A[j])
return A[0]
print([str(bernoulli(n)) for n in range(8)])That is the decoded payload rendered live: each line of the program is on its own line, indentation preserved, no \n in sight.
4. Citations and bibliography
The snippet's source, Notes by the Translator (Ada Lovelace, 1843), is cited inline:[1] Lovelace's note described the computation of Bernoulli numbers on the Analytical Engine — widely regarded as the first published computer program, and the direct inspiration for this snippet.[1]
The Babbage quotation Pray, Mr. Babbage, … embeds the same way: rendered embed — its source is collected automatically too.
Bibliography
Sources collected automatically
The {{#citations:}} collector gathers the same sources here — deduplicated across the inline citations above and the embed URLs in § 3:
- Lovelace, A. (1843). Notes by the Translator. In Notes by the Translator. R. & J. E. Taylor. https://doi.org/10.1000/notes
- Babbage, C. (1864). Passages from the Life of a Philosopher. In Passages from the Life of a Philosopher. Longman.
5. Try it yourself
- Open Item:Q1129 and edit its
code sourcestatement — § 3 updates immediately. - See the help pages: Help:Contributing/code, Help:Contributing/citations, Help:Contributing/semanticDynamicContent, Help:Contributing/quotation, Help:Contributing/math.