Reference

# Stream Expression Language

Complete technical reference for SEL syntax, operators, constants, and all functions.

Copy MarkdownOpen

The **Stream Expression Language (SEL)** lets you write custom logic to filter, rank, and select streams. It is used in **Groups**, **Stream Expression Filters**, **Precompute Selectors**, and more.

* * *

## [Operators](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#operators)

| Operator | Description | Example |
| --- | --- | --- |
| `==` | Equal | `queryType == 'movie'` |
| `!=` | Not equal | `queryType != 'series'` |
| `>``<``>=``<=` | Comparison | `count(previousStreams) > 5` |
| `in` | Membership — value exists in sequence | `'Torrentio' in queriedAddons` |
| `+``-``*``/` | Arithmetic | `totalTimeTaken / 1000` |
| `and``or``not` | Logical | `isAnime and season == 1` |
| `x ? y : z` | Ternary | `isAnime ? seadex(streams) : streams` |
| `()` | Grouping | `(a or b) and c` |

* * *

## [Nesting Functions](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#nesting-functions)

Most functions accept a stream list as input and return a stream list as output. Chain them together by nesting:

```
count(resolution(cached(streams), '2160p'))
```

1. `cached(streams)` — get only cached streams
2. `resolution(..., '2160p')` — keep only 4K ones
3. `count(...)` — count how many remain

* * *

## [Context Constants](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#context-constants)

The constants available to you depend on where the expression is used.

### [Group Conditions](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#group-conditions)

| Constant | Type | Description |
| --- | --- | --- |
| `previousStreams` | `ParsedStream[]` | Streams found by the last group that ran |
| `totalStreams` | `ParsedStream[]` | All streams found by all groups so far |
| `queryType` | `string` | Media type being searched (e.g. `"movie"`, `"series"`) |
| `previousGroupTimeTaken` | `number` | Time the last group took (ms) |
| `totalTimeTaken` | `number` | Total time spent so far (ms) |

### [Dynamic Exit Conditions](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#dynamic-exit-conditions)

| Constant | Type | Description |
| --- | --- | --- |
| `totalStreams` | `ParsedStream[]` | All streams found by all groups so far |
| `totalTimeTaken` | `number` | Total time spent so far (ms) |
| `queryType` | `string` | Media type (e.g. `"movie"`, `"series"`, `"anime.series"`, `"anime.movie"`) |
| `queriedAddons` | `string[]` | Addon names queried so far |

### [Stream Expression Filters & Precompute Selector](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#stream-expression-filters--precompute-selector)

| Constant | Type | Default | Description |
| --- | --- | --- | --- |
| `streams` | `ParsedStream[]` | — | All available streams |
| `queryType` | `string` | `''` | Media type |
| `isAnime` | `boolean` | `false` | Whether the media is anime |
| `season` | `number` | `-1` | Season number |
| `episode` | `number` | `-1` | Episode number |
| `absoluteEpisode` | `number` | `-1` | Absolute episode number |
| `genres` | `string[]` | `[]` | List of genres |
| `title` | `string` | `''` | Media title |
| `year` | `number` | `0` | Release year |
| `yearEnd` | `number` | `0` | End year (series) |
| `daysSinceRelease` | `number` | `-1` | Days since media was released |
| `runtime` | `number` | `0` | Runtime in minutes |
| `originalLanguage` | `string` | `''` | Original language (e.g. `"English"`) |
| `hasSeaDex` | `boolean` | `false` | Whether SeaDex results exist for this media |
| `hasNextEpisode` | `boolean` | `false` | Whether a next episode exists |
| `daysUntilNextEpisode` | `number` | `-1` | Days until next episode airs |
| `daysSinceFirstAired` | `number` | `-1` | Days since the first episode aired |
| `daysSinceLastAired` | `number` | `-1` | Days since the last episode aired |
| `latestSeason` | `number` | `-1` | Latest season number |
| `ongoingSeason` | `boolean` | `false` | Viewing the latest season with a next episode pending |

* * *

## [Naming Expressions](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#naming-expressions)

Assign a name to a Stream Expression by adding a C-style comment. The name is used in the [Custom Formatter](https://docs.aiostreams.viren070.me/reference/custom-formatter/).

```
/* 4K Dolby Vision */ merge(resolution(streams, '2160p'), visualTag(streams, 'DV'))
```

Multiple names (for Ranked Stream Expressions):

```
/* 4K */ resolution(streams, '2160p') /* High Quality */
```

Reference-only comment (not used as a name — start with `#`):

```
/*# This is just a note */ quality(streams, 'Bluray')
```

### [Preferred vs. Ranked](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#preferred-vs-ranked)

| Type | Matching behaviour | Formatter variable |
| --- | --- | --- |
| **Preferred** | Stream matches only the _first_ expression it satisfies | `{stream.seMatched}` |
| **Ranked** | Stream can match _multiple_ expressions; scores are summed | `{stream.rseMatched}` |

* * *

## [Function Reference](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#function-reference)

### [Utility Functions](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#utility-functions)

#### [`negate()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#negate)

Returns streams from `originalStreamList` that are **not** in `streamsToExclude`.

| Parameter | Type | Description |
| --- | --- | --- |
| `streamsToExclude` | `ParsedStream[]` | Streams to exclude |
| `originalStreamList` | `ParsedStream[]` | Full stream list to filter from |

```
negate(quality(streams, 'CAM', 'TS'), streams)
```

* * *

#### [`merge()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#merge)

Combines multiple stream arrays into one, removing duplicates.

```
merge(visualTag(streams, 'DV'), audioTag(streams, 'Atmos'))
```

* * *

#### [`slice()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#slice)

Returns a section of the stream list. Negative indices count from the end.

| Parameter | Type | Description |
| --- | --- | --- |
| `streams` | `ParsedStream[]` | Stream list to slice |
| `start` | `number` | Start index (inclusive) |
| `end` | `number?` | End index (exclusive). Omit to go to the end. |

```
slice(addon(streams, 'TorBox'), 0, 5)  // first 5 TorBox streams
```

* * *

#### [`perGroup()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#pergroup)

Groups streams by an attribute, keeps up to **`n`** streams from each group, then **interleaves** the groups round-robin so results are balanced across all values.

| Parameter | Type | Description |
| --- | --- | --- |
| `streams` | `ParsedStream[]` | Stream list |
| `attribute` | `string` | The stream property to group by (see below) |
| `n` | `number` | Maximum streams to take from each group (must be a positive integer) |
| `...filterValues` | `string?` | Optional group keys to include. If omitted, **all** groups are included. Matching is case-insensitive. |

**Supported attributes:**

| Attribute | Groups by |
| --- | --- |
| `resolution` | Video resolution (`2160p`, `1080p`, …) |
| `quality` | Quality tag (`Bluray`, `WEB-DL`, …) |
| `encode` | Encoding format (`H.265`, `AV1`, …) |
| `type` | Stream type (`debrid`, `p2p`, …) |
| `service` | Debrid service ID (`realdebrid`, `torbox`, …) |
| `indexer` | Indexer name (`Torrentio`, `Knightcrawler`, …) |
| `releaseGroup` | Release group name (`YIFY`, `FLUX`, …) |
| `visualTag` | Visual tag (`DV`, `HDR`, `HDR10+`, …) |
| `audioTag` | Audio format tag (`Atmos`, `DTS-HD MA`, …) |
| `audioChannel` | Audio channel layout (`5.1`, `7.1`, …) |
| `language` | Audio language (`English`, `Japanese`, …) |
| `subtitle` | Subtitle language (`English`, `Japanese`, …) |

Streams with no value for the chosen attribute are bucketed under `'Unknown'` (or `'none'` for `service`).

For multi-value attributes (`visualTag`, `audioTag`, `audioChannel`, `language`, `subtitle`) a stream is assigned to the **first** group key that matches the `filterValues` list, or to its first value when no filter is specified. A stream is never included more than once in the output.

**How interleaving works:**

Given streams `[A1, A2, B1, B2, C1]` grouped by resolution with `n=2`:

- Group `2160p`: `[A1, A2]`
- Group `1080p`: `[B1, B2]`
- Group `720p`: `[C1]`

Result: `[A1, B1, C1, A2, B2]` — one from each group per round.

```
// Up to 3 streams per resolution, all resolutions
perGroup(streams, 'resolution', 3)

// Up to 2 streams per resolution, 4K and 1080p only
perGroup(streams, 'resolution', 2, '2160p', '1080p')

// Up to 1 stream per debrid service
perGroup(type(streams, 'debrid'), 'service', 1)

// Top 2 streams from each addon, balanced
perGroup(streams, 'indexer', 2)
```

* * *

#### [`values()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#values)

Extracts a numeric property from each stream as an array of numbers. Used with [Math Functions](https://docs.aiostreams.viren070.me/reference/stream-expressions/#math-functions).

| Parameter | Type | Description |
| --- | --- | --- |
| `streams` | `ParsedStream[]` | Stream list |
| `attribute` | `string` | Property to extract |

**Accepted attributes:**`'bitrate'``'size'``'folderSize'``'age'``'duration'``'seeders'``'seScore'``'regexScore'`

```
avg(values(streams, 'bitrate'))
```

* * *

### [Filter Functions](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#filter-functions)

All filter functions follow the pattern: `fn(streams, ...values)` → `ParsedStream[]`

* * *

#### [`indexer()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#indexer)

Filter by originating indexer name (case-sensitive).

```
indexer(streams, '1337x', 'RARBG')
```

* * *

#### [`resolution()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#resolution)

Filter by video resolution.

**Accepted values:**`'2160p'``'1440p'``'1080p'``'720p'``'576p'``'480p'``'360p'``'240p'``'144p'``'Unknown'`

```
resolution(streams, '2160p', '1080p')
```

* * *

#### [`quality()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#quality)

Filter by quality tag.

**Accepted values:**`'Bluray REMUX'``'Bluray'``'WEB-DL'``'WEBRip'``'HDRip'``'HC HD-Rip'``'DVDRip'``'HDTV'``'CAM'``'TS'``'TC'``'SCR'``'Unknown'`

```
quality(streams, 'Bluray', 'WEB-DL')
```

* * *

#### [`encode()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#encode)

Filter by video encoding format (e.g. `'H.264'`, `'H.265'`, `'HEVC'`, `'x265'`).

```
encode(streams, 'H.265', 'HEVC')
```

* * *

#### [`type()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#type)

Filter by stream type.

**Accepted values:**`'debrid'``'usenet'``'http'``'live'``'p2p'``'external'``'youtube'`

```
type(streams, 'debrid', 'p2p')
```

* * *

#### [`visualTag()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#visualtag)

Filter by visual tag (e.g. `'HDR'`, `'DV'`, `'HDR10'`, `'HDR10+'`, `'HLG'`).

```
visualTag(streams, 'DV', 'HDR')
```

* * *

#### [`audioTag()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#audiotag)

Filter by audio format tag (e.g. `'Atmos'`, `'DTS'`, `'DTS-HD MA'`, `'AC3'`, `'EAC3'`).

```
audioTag(streams, 'Atmos', 'DTS-HD MA')
```

* * *

#### [`audioChannels()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#audiochannels)

Filter by audio channel configuration (e.g. `'5.1'`, `'7.1'`, `'2.0'`).

```
audioChannels(streams, '5.1', '7.1')
```

* * *

#### [`language()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#language)

Filter by audio language (e.g. `'English'`, `'Spanish'`).

```
language(streams, 'English')
```

* * *

#### [`subtitle()` / `subtitles()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#subtitle--subtitles)

Filter by subtitle language (e.g. `'English'`, `'Spanish'`).

```
subtitle(streams, 'English')
subtitles(streams, 'English')
```

* * *

#### [`seeders()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#seeders)

Filter by torrent seeder count.

| Parameter | Type | Description |
| --- | --- | --- |
| `streams` | `ParsedStream[]` | Stream list |
| `min` | `number?` | Minimum seeders (inclusive) |
| `max` | `number?` | Maximum seeders (inclusive) |

```
seeders(streams, 5, 200)
```

* * *

#### [`age()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#age)

Filter by age in hours.

| Parameter | Type | Description |
| --- | --- | --- |
| `streams` | `ParsedStream[]` | Stream list |
| `min` | `number?` | Minimum age in hours |
| `max` | `number?` | Maximum age in hours |

```
age(streams, 24, 8760)  // 1 day to 1 year old
```

* * *

#### [`size()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#size)

Filter by file size. Accepts human-readable strings (`'1GB'`, `'500MB'`) or raw byte counts.

| Parameter | Type | Description |
| --- | --- | --- |
| `streams` | `ParsedStream[]` | Stream list |
| `min` | `number | string?` | Minimum size |
| `max` | `number | string?` | Maximum size |

```
size(streams, '1GB', '10GB')
```

* * *

#### [`bitrate()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#bitrate)

Filter by bitrate. Accepts `'5Mbps'`, `'5000kbps'`, or raw bits-per-second.

| Parameter | Type | Description |
| --- | --- | --- |
| `streams` | `ParsedStream[]` | Stream list |
| `min` | `number | string?` | Minimum bitrate |
| `max` | `number | string?` | Maximum bitrate |

```
bitrate(streams, '5Mbps')
```

* * *

#### [`service()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#service)

Filter by Debrid service.

**Accepted values:**`'realdebrid'``'debridlink'``'alldebrid'``'torbox'``'pikpak'``'seedr'``'offcloud'``'premiumize'``'easynews'``'nzbdav'``'altmount'``'stremio_nntp'``'easydebrid'``'debrider'`

```
service(streams, 'realdebrid', 'torbox')
```

* * *

#### [`cached()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#cached)

Filter for cached Debrid streams only.

```
cached(streams)
```

* * *

#### [`uncached()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#uncached)

Filter for non-cached streams only.

```
uncached(streams)
```

* * *

#### [`releaseGroup()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#releasegroup)

Filter by release group name (case-sensitive). Omitting names matches streams with _any_ release group.

```
releaseGroup(streams, 'YIFY', 'FLUX')
```

* * *

#### [`seasonPack()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#seasonpack)

Filter for season pack streams.

| Parameter | Type | Description |
| --- | --- | --- |
| `streams` | `ParsedStream[]` | Stream list |
| `mode` | `string?` | `'seasonPack'` — stream originates from a season pack. `'onlySeasons'` _(default)_ — title contains only season info, no episode info (ambiguous pack). |

```
seasonPack(streams, 'seasonPack')   // from any season pack
seasonPack(streams, 'onlySeasons')  // ambiguous packs without episode reference
```

* * *

#### [`addon()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#addon)

Filter by addon name (case-sensitive).

```
addon(streams, 'Torrentio', 'Knightcrawler')
```

* * *

#### [`library()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#library)

Filter for streams from a personal Debrid library.

```
library(streams)
```

* * *

#### [`message()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#message)

Filter by a stream's `message` property.

| Parameter | Type | Description |
| --- | --- | --- |
| `streams` | `ParsedStream[]` | Stream list |
| `mode` | `'exact' | 'includes'` | Exact match or substring |
| `...messages` | `string` | One or more message strings |

```
message(streams, 'includes', 'cached')
```

* * *

#### [`seadex()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#seadex)

Filter for [SeaDex](https://releases.moe/)-listed streams (best anime releases).

| Parameter | Type | Description |
| --- | --- | --- |
| `streams` | `ParsedStream[]` | Stream list |
| `type` | `'best' | 'all'?` | `'best'` for only SeaDex "Best" entries; omit or `'all'` for all SeaDex matches |

Only active when SeaDex integration is enabled under **Filters →**
**Miscellaneous**.

```
seadex(streams, 'best')
```

* * *

#### [`keyword()` / `keywords()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#keyword--keywords)

Filter streams by one or more keywords. Uses the same matching logic as the Keyword UI filters (Required / Excluded / Included / Preferred Keywords): keywords are escaped and joined into a single case-insensitive regex with the same word-boundary heuristics. You explicitly choose which stream attribute(s) the keywords are tested against.

Useful when you want fine-grained keyword filtering inside an SEL expression (e.g. inside a group, ranked stream expression, or precompute selector) without affecting the global keyword filters.

| Parameter | Type | Description |
| --- | --- | --- |
| `streams` | `ParsedStream[]` | Stream list |
| `attributes` | `string` | Comma-separated attribute names that the keywords should be tested against. Use `'all'` or `'*'` to match every attribute. Case-insensitive. |
| `...keywords` | `string` | One or more keyword strings. Whitespace inside a keyword matches separators like `.`, `_`, `-`. |

**Accepted attribute names:**`filename`, `folderName`, `indexer`, `releaseGroup` — the same set the Keyword UI filters check.

```
keyword(streams, 'filename', 'remux')                      // match 'remux' only in filenames
keyword(streams, 'filename,releaseGroup', 'flux', 'ntb')   // multiple attributes, multiple keywords
keywords(streams, 'all', 'extended cut')                   // match every attribute (= UI keyword filter behavior)
keyword(streams, '*', 'remux')                             // shorthand for 'all'
```

To exclude streams matching the keywords, combine with [`negate()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#negate):

```
negate(keyword(streams, 'all', 'cam', 'hdcam'), streams)
```

* * *

#### [`regexMatched()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#regexmatched)

Filter for streams that matched a preferred or ranked regex filter.

| Parameter | Type | Description |
| --- | --- | --- |
| `streams` | `ParsedStream[]` | Stream list |
| `...names` | `string?` | Optional filter names. If omitted, matches any regex filter. |

Does not work in **Included Stream Expressions** — regex matching is computed
after filtering.

```
regexMatched(streams)                          // matched any regex
regexMatched(streams, 'HighQuality', 'Extras') // matched specific ones
```

* * *

#### [`regexMatchedInRange()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#regexmatchedinrange)

Filter for streams where the matched regex filter's index is within `[min, max]`.

Does not work in **Included Stream Expressions**. This only uses
`stream.regexMatched` (preferred regex result), so it does **not** work with
ranked regex matches.

```
regexMatchedInRange(streams, 0, 5)
```

* * *

#### [`seMatched()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#sematched)

Filter for streams that matched a preferred Stream Expression.

| Parameter | Type | Description |
| --- | --- | --- |
| `streams` | `ParsedStream[]` | Stream list |
| `...names` | `string?` | Optional expression names. If omitted, matches any preferred expression. |

```
seMatched(streams)                    // matched any preferred expression
seMatched(streams, '4K', 'Anime HQ') // matched specific expression names
```

* * *

#### [`seMatchedInRange()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#sematchedinrange)

Filter for streams where the matched preferred Stream Expression index is within `[min, max]`.

Does not work in **Included Stream Expressions**. This only uses
`stream.streamExpressionMatched` (preferred Stream Expression result), so it
does **not** work with ranked stream expressions.

```
seMatchedInRange(streams, 0, 3)
```

* * *

#### [`rseMatched()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#rsematched)

Filter for streams that matched one or more ranked Stream Expressions.

| Parameter | Type | Description |
| --- | --- | --- |
| `streams` | `ParsedStream[]` | Stream list |
| `...names` | `string?` | Optional ranked expression names. If omitted, matches any ranked hit. |

```
rseMatched(streams)                    // matched any ranked expression
rseMatched(streams, 'BD T1', 'Web T1') // matched specific ranked names
```

* * *

#### [`streamExpressionScore()` / `seScore()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#streamexpressionscore--sescore)

Filter by Ranked Stream Expression score.

Does not work in **Included Stream Expressions**.

```
streamExpressionScore(streams, 100, 500)
```

* * *

#### [`regexScore()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#regexscore)

Filter by Ranked Regex score.

Does not work in **Included Stream Expressions**.

```
regexScore(streams, 50)
```

* * *

#### [`passthrough()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#passthrough)

Flags streams to bypass specific pipeline stages. Best used in **Included Stream Expressions** or rarely in **Excluded Stream Expressions**.

While any stream selected by an Included Stream Expression (ISE) is already protected from normal filters, it still passes through stages like deduplication and result limiting. Wrapping your ISE with `passthrough()` expands which stages those streams skip.

When used in an **Excluded Stream Expression**: flagged streams won't be removed by _subsequent_ excluded expressions. Since ESE filters run last, most stage values are not applicable here — only `excluded` is relevant.

| Parameter | Type | Description |
| --- | --- | --- |
| `streams` | `ParsedStream[]` | Stream list |
| `...stages` | `string?` | Stages to skip. Omit to bypass all stages. |

**Accepted stage values:**`filter``language``subtitle``dedup``limit``excluded``required``title``year``episode``digitalRelease`

```
passthrough(streams, 'language', 'limit')
passthrough(streams)  // bypass all stages
```

* * *

#### [`pin()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#pin)

Pins streams to the very top or bottom of the final results list, overriding sort order. Typically used in **Excluded Stream Expressions**. Can also be used in **Required Stream Expressions** — but since unselected streams get filtered out, set `returnMatched: true` when doing so.

| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `streams` | `ParsedStream[]` | — | Streams to pin |
| `position` | `'top' | 'bottom'` | `'top'` | Where to pin them |
| `returnMatched` | `boolean` | `false` | `true` → return pinned streams; `false` → return empty array (useful for chaining) |

```
pin(seadex(streams, 'best'), 'top')
```

* * *

### [Math Functions](https://docs.aiostreams.viren070.me/reference/stream-expressions/\#math-functions)

Math functions operate on arrays of numbers, typically from [`values()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#values).

Most accept either an array (`avg(values(streams, 'bitrate'))`) or individual arguments (`avg(1, 2, 3)`).

| Function | Alias | Description |
| --- | --- | --- |
| `count(arr)` | — | Number of items in the array |
| `max(numbers)` | — | Largest value |
| `min(numbers)` | — | Smallest value |
| `avg(numbers)` | `mean` | Arithmetic mean |
| `sum(numbers)` | — | Sum of all values |
| `median(numbers)` | `q2` | Middle value (50th percentile) |
| `mode(numbers)` | — | Most frequently occurring value |
| `range(numbers)` | — | `max - min` |
| `variance(numbers)` | — | Spread from the average |
| `stddev(numbers)` | — | Standard deviation |
| `percentile(numbers, p)` | — | Value below which `p`% of observations fall |
| `q1(numbers)` | — | First quartile (25th percentile) |
| `q3(numbers)` | — | Third quartile (75th percentile) |
| `iqr(numbers)` | — | Interquartile range (`q3 - q1`) |
| `skewness(numbers)` | — | Asymmetry of the distribution |
| `kurtosis(numbers)` | — | "Tailedness" of the distribution |

[Development\\
\\
How to set up AIOStreams locally for development and contribution.](https://docs.aiostreams.viren070.me/guides/development/) [Custom Formatter\\
\\
Complete reference for formatting stream names and descriptions using variables, modifiers, and conditionals.](https://docs.aiostreams.viren070.me/reference/custom-formatter/)

### On this page

[Operators](https://docs.aiostreams.viren070.me/reference/stream-expressions/#operators) [Nesting Functions](https://docs.aiostreams.viren070.me/reference/stream-expressions/#nesting-functions) [Context Constants](https://docs.aiostreams.viren070.me/reference/stream-expressions/#context-constants) [Group Conditions](https://docs.aiostreams.viren070.me/reference/stream-expressions/#group-conditions) [Dynamic Exit Conditions](https://docs.aiostreams.viren070.me/reference/stream-expressions/#dynamic-exit-conditions) [Stream Expression Filters & Precompute Selector](https://docs.aiostreams.viren070.me/reference/stream-expressions/#stream-expression-filters--precompute-selector) [Naming Expressions](https://docs.aiostreams.viren070.me/reference/stream-expressions/#naming-expressions) [Preferred vs. Ranked](https://docs.aiostreams.viren070.me/reference/stream-expressions/#preferred-vs-ranked) [Function Reference](https://docs.aiostreams.viren070.me/reference/stream-expressions/#function-reference) [Utility Functions](https://docs.aiostreams.viren070.me/reference/stream-expressions/#utility-functions) [`negate()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#negate) [`merge()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#merge) [`slice()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#slice) [`perGroup()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#pergroup) [`values()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#values) [Filter Functions](https://docs.aiostreams.viren070.me/reference/stream-expressions/#filter-functions) [`indexer()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#indexer) [`resolution()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#resolution) [`quality()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#quality) [`encode()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#encode) [`type()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#type) [`visualTag()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#visualtag) [`audioTag()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#audiotag) [`audioChannels()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#audiochannels) [`language()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#language) [`subtitle()` / `subtitles()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#subtitle--subtitles) [`seeders()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#seeders) [`age()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#age) [`size()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#size) [`bitrate()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#bitrate) [`service()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#service) [`cached()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#cached) [`uncached()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#uncached) [`releaseGroup()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#releasegroup) [`seasonPack()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#seasonpack) [`addon()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#addon) [`library()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#library) [`message()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#message) [`seadex()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#seadex) [`keyword()` / `keywords()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#keyword--keywords) [`regexMatched()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#regexmatched) [`regexMatchedInRange()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#regexmatchedinrange) [`seMatched()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#sematched) [`seMatchedInRange()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#sematchedinrange) [`rseMatched()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#rsematched) [`streamExpressionScore()` / `seScore()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#streamexpressionscore--sescore) [`regexScore()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#regexscore) [`passthrough()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#passthrough) [`pin()`](https://docs.aiostreams.viren070.me/reference/stream-expressions/#pin) [Math Functions](https://docs.aiostreams.viren070.me/reference/stream-expressions/#math-functions)