---
slug: "Rank"
name: "Rank"
type: "Primitives"
layer: "Infrastructure"
ref: "Rank#67c6"
sema_id: "sema:Rank#mh:SHA-256:67c6fb568c5fdcfbd0de64b8a5413e943378d421dee9d5614c827e3c539bde3f"
tags: ["Infrastructure","Primitives"]
updated: 2026-11-11
mindscape: "bootstrap"
index_url: https://mindscape.pages.dev/bootstrap/index.json
url: https://mindscape.pages.dev/bootstrap/Rank/
related: ["ScoringFunction","Select","Abduction","BeamSearch","Prioritize"]
---

# Rank

Order items by score

Layer: Infrastructure · Category: Primitives

## Mechanism

Deterministic Sort. Applies a caller-supplied [ScoringFunction](https://mindscape.pages.dev/bootstrap/ScoringFunction.md) to every element in the input Set and returns a List ordered by Score. Uses [Select](https://mindscape.pages.dev/bootstrap/Select.md) to truncate to Top-K when requested.

## Invariants

- Conservation: Output set is a subset of Input set.
- Monotonicity: For all i, Score(Output[i]) >= Score(Output[i+1]).

## Failure modes

- Score Indeterminacy: Multiple items have identical scores.
- Incomparability: Scoring function returns values that cannot be strictly ordered.

## Builds on

- [ScoringFunction](https://mindscape.pages.dev/bootstrap/ScoringFunction.md) (Infrastructure; Accepts)
- [Select](https://mindscape.pages.dev/bootstrap/Select.md) (Infrastructure; Composes with)

## Used by

- [Abduction](https://mindscape.pages.dev/bootstrap/Abduction.md) (Mind; References)
- [BeamSearch](https://mindscape.pages.dev/bootstrap/BeamSearch.md) (Mind; References)
- [Prioritize](https://mindscape.pages.dev/bootstrap/Prioritize.md) (Mind; Composes with)

## Identity

- Sema ID: `sema:Rank#mh:SHA-256:67c6fb568c5fdcfbd0de64b8a5413e943378d421dee9d5614c827e3c539bde3f`
- Ref: `Rank#67c6`
- Supersedes:
  - `sema:Rank#mh:SHA-256:cb98b1357a2b6e14ff1e76bca44014fabffb0936b453ba88c3ad4561a63d3c2f`
  - `sema:Rank#mh:SHA-256:44ff9eebfbb89e603509718bad8954e38aa800ed22b697bb853e781aea9cb104`

## Links

- [Pattern page](https://mindscape.pages.dev/bootstrap/Rank/)
- [View in the interactive graph](https://mindscape.pages.dev/bootstrap/#Rank)
- [JSON](https://mindscape.pages.dev/bootstrap/Rank.json)
- [Index of all patterns](https://mindscape.pages.dev/bootstrap/index.json)
