Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ToberlerOhn/hades/llms.txt

Use this file to discover all available pages before exploring further.

Hades provides two sequential collection types: lists are the fully-implemented, mutable workhorse container you use for most data; records are an immutable sequence type described in the language specification but not yet executed by the current interpreter.

Lists

A list is an ordered, mutable sequence of values enclosed in square brackets. Elements are comma-separated and may be of mixed types.
scores: list = [95, 87, 92, 78];
mixed:  list = [1, 'hello', TRUE, 3.14];
empty:  list = [];

Indexed access

Use the -> operator followed by a zero-based integer index to read an element:
scores: list = [95, 87, 92, 78];
first: int = scores->0;   // 95
third: int = scores->2;   // 92
Accessing an index outside the list’s bounds raises a runtime error. Use len(scores) to guard boundary checks.

Index assignment

The same -> syntax on the left-hand side of an assignment mutates the element at that position:
scores->0 = 100;
print(scores->0);   // 100
All compound assignment operators work on list elements too:
scores->1 += 5;     // 87 + 5 = 92
scores->2 *= 2;     // 92 * 2 = 184

Iterating over a list

Use the for-in loop to visit every element. The loop variable is typed and each element is checked at runtime:
scores: list = [95, 87, 92, 78];

for (score: int; score in scores) {
    print(score)
}
// outputs:
// 95
// 87
// 92
// 78

Membership testing with in

The in operator returns TRUE if the left-hand value is present in the list:
scores: list = [95, 87, 92, 78];

if (92 in scores) {
    print('found 92')
}

if (!(50 in scores)) {
    print('50 is not in scores')
}

Getting the length

The built-in len function returns the number of elements:
scores: list = [95, 87, 92, 78];
print(len(scores));   // 4

Records

Records are described in the Hades language specification but are not yet implemented in the current interpreter. There is no RecordNode in the parser and no record handler in the interpreter. The rec type hint keyword listed in the README is also absent from the interpreter’s recognised type hints. The syntax below documents the planned design; using it in the current release will produce an error.
A record is planned as an immutable sequence declared as a comma-separated string literal enclosed in double quotes. Unlike lists, records would require no element type hints and could not be modified after creation.
// Planned syntax — records are not yet supported by the interpreter
coords: record = "10, 20, 30";
weekdays: record = "Mon, Tue, Wed, Thu, Fri";

Planned indexed access

Record elements would be accessed using the variable name followed by the index in double quotes:
// Planned syntax
coords: record = "10, 20, 30";
first: str = coords"0";    // "10"
second: str = coords"1";   // "20"

Immutability

When records are implemented, attempting to assign to a record element will raise a TypeError:
// Planned behaviour
coords"0" = 99;   // TypeError — records are immutable

Comparison: list vs. record

list

  • Declared with [ ]
  • Elements accessed via container->index
  • Mutable — elements can be updated
  • Iterable with for-in
  • Works with in membership operator
  • len() supported
  • Fully implemented

record

  • Declared as a comma-separated "string"
  • Elements accessed via container"index" (planned)
  • Immutable — mutation raises a TypeError (planned)
  • No element type annotation required
  • Not yet implemented in the interpreter

Practical example

// Build a list of test scores, update it, and report results
scores: list = [72, 85, 90, 68, 95];

// Fix a data-entry error
scores->0 = 75;

// Find the sum manually
total: int = 0;
for (s: int; s in scores) {
    total += s
}
print('Total: ', total);         // Total: 413
print('Count: ', len(scores));   // Count: 5

// Check membership
if (95 in scores) {
    print('Top score present')
}
Lists are the primary collection type in the current interpreter. Use them for any ordered, mutable data. Record support is planned for a future release.

Build docs developers (and LLMs) love