Examples¶
The example corpus is where HQL's features are designed: an example is written first, and the implementation is held to it. Each query file declares its expected type and result in a header, and the test suite runs every one.
| Corpus | What it shows |
|---|---|
| birds | Linked cards with runnable collection queries: repeated sightings, distinct species, keyed counts, ordered routes and sorted keys — plus intentional errors for duplicate keys and non-orderable sorted-map keys |
| mapreduce | Six book cards to filter, group and reduce. Some queries run today; others are written ahead of group, reduce and collect |
Reading a query header¶
// status: valid-now
// feature: Bird cards as a set and a sorted list
// implementation: implemented
// vault: birds/wiki
// expected-type: List<String>
// expected: [Barn owl, Common raven, European robin]
A header may instead say status: proposed with implementation: pending and
a proposal: naming the record that specifies it. Such a case is a design
input, pinned before it runs, and the suite asserts that it does not check
yet — the day it does, it has to be promoted.
Running one¶
From a clone, after cargo build --locked:
target/debug/hql --vault examples/birds/wiki run examples/birds/queries/catalog.hql