> For the complete documentation index, see [llms.txt](https://clarity-7.gitbook.io/clarity-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://clarity-7.gitbook.io/clarity-docs/clarity-moniversive-invariant-static-mis/language-and-coding-breakdown/high-level-ergonomics.md).

# High-level ergonomics

> Generated 2026-07-29T03:15:30Z · compile to static **`.mis`** / `.clrty` kernels · **`bin/misc`**

| High-level concept | Python                | MIS (authoring)                    | Primitive          |
| ------------------ | --------------------- | ---------------------------------- | ------------------ |
| Variable           | `x = 100`             | `let x: mis_int = 100`             | static register    |
| Branchless branch  | `if c: x=a else: x=b` | `x = mis.select(c, a, b)`          | SIMD mask          |
| Guard              | `assert bal >= amt`   | `mis.invariant(bal >= amt)`        | compile-time guard |
| Loop / map         | `for x in xs:`        | `mis.vector_map(xs, kernel_fn)`    | unrolled SIMD      |
| Function           | `def transfer(...):`  | `outcome transfer` / `fn transfer` | `mis_kernel`       |

## Token transfer (conceptual)

Python uses exceptions; MIS uses **invariants** and **branchless** arithmetic, then atomic store.

```mis
// Author in .mis — check with bin/misc
outcome transfer_checked:
  mis.invariant(sender_bal >= amount);
  new_sender = sender_bal - amount;
  new_recv = recv_bal + amount;
  mis.store(sender, new_sender);
  mis.store(recipient, new_recv);
```

## Core mechanics

1. **Branchless abstractions** — `mis.select(mask, a, b)` instead of runtime `if/else` jumps.
2. **Invariants over exceptions** — `mis.invariant()` / `invariant` keyword in `.mis`.
3. **Bounded collections** — `mis_set`, `mis_dict`, `mis_array` with compile-time capacity.

Module reference: `languages/mis-ml/mis/HighLevelErgonomics.mis` · [collections & concurrency](/clarity-docs/clarity-moniversive-invariant-static-mis/language-and-coding-breakdown/collections-concurrency.md) · [definitions & sets](/clarity-docs/clarity-moniversive-invariant-static-mis/language-and-coding-breakdown/definitions-variables-sets.md).

```bash
bin/misc moniversive/framework/mis_lang.mis --check --compact-letters
make misc-build
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://clarity-7.gitbook.io/clarity-docs/clarity-moniversive-invariant-static-mis/language-and-coding-breakdown/high-level-ergonomics.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
