> ## Documentation Index
> Fetch the complete documentation index at: https://torqpy.itsdote.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Ergonomics

> Context-bound helpers, wait sugar, patterns, and optional @shred unary plus.

```python theme={null}
from torq import (
    Clock, second, ms,
    spork, shreds, now, wait, until, every, at,
    Pat, p, shred, ShredFn, ShredCall,
)
```

## Context helpers

| Symbol | Meaning |
| - | - |
| `spork`, `shreds`, `now` | Context-bound helpers |
| `wait(dur)`, `until(time)` | Suspend helpers |
| `every(dur)`, `at(time)` | Scheduling helpers |
| `~dur` | Wait token (`Wait`); async: `await (~dur)` |
| `time ^ dur` | Time offset sugar |
| `Pat`, `p["x-x-"]` | Pattern helpers |
| `@shred` / `ShredFn` / `ShredCall` | Enables unary `+` / `+fn(...)` spork — **not** required for async |

Shreds may be generators (`yield dur` or `yield ~dur`) or `async def` driven by torq.py (not `asyncio.run`). Prefer keeping `while` / `yield` available; shortcuts are additions, not replacements.

## Patterns

```python theme={null}
from torq import Clock, ms, p, spork

clock = Clock()
hits = []
pat = p["x-x-"]

def play():
    for hit in pat:
        if hit:
            hits.append(clock.now)
        yield 100 * ms

clock.spork(play())
clock.run()
```

## Optional unary `+`

`@shred` is **only** for unary `+`. It is not required for async or for `spork(fn)`.

```python theme={null}
from torq import Clock, second, now, shred

clock = Clock()
hits = []

@shred
def metro(period, name):
    hits.append((name, now()))
    yield ~(period * second)
    hits.append((name, now()))

with clock:
    +metro(1, "a")   # same as spork(metro(1, "a"))
clock.run()
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.