<!-- Sema documentation — std.document
     Sema is a new AI-native, neurosymbolic programming language most models
     have not been trained on. Full corpus: https://sema.49.12.246.95.sslip.io/llms-full.txt
     Install language support: https://sema.49.12.246.95.sslip.io/install-skill/ -->

# std.document

> Reflected API reference for the Sema standard-library module std.document.

> Generated by `sema doc` from `stdlib/sema/document.sema`. Import with `from std.document import …`. For a narrative introduction see [std.document](/stdlib/document/).

# `document`

std.document — typed document IR + deterministic render (design ⑦).

The model fills a typed `Report`; rendering to markdown is a pure, deterministic
function — no regex repair of freeform LLM markdown, and section/table placement is
structural. Replaces a hand-rolled `assemble_basic_answer`/`_assemble_report`.
`nl` is the newline separator, parametrizable so the same renderer can emit a
single-line form for tests or real newlines for output.

# `struct Report`

**Fields**

| field | type | descriptor |
|---|---|---|
| `title` | `str` |  |
| `context` | `str` |  |
| `confidence` | `f64` |  |
| `rationale` | `str` |  |
| `takeaways` | `list[str]` |  |
| `section_titles` | `list[str]` |  |
| `sections_text` | `str` |  |
| `conclusion` | `str` |  |

# `def fmt1`

```sema
def fmt1(x: f64) -> str !{}
```

**Parameters**

| name | type |
|---|---|
| `x` | `f64` |

**Returns** `str`

**Effects** `!{}`

# `def render`

```sema
def render(r: Report, nl: str) -> str !{}
```

**Parameters**

| name | type |
|---|---|
| `r` | `Report` |
| `nl` | `str` |

**Returns** `str`

**Effects** `!{}`
