रेंडरिंगhi

दोहराओ

Translation status: हिन्दी reader-locale proof. Term names and code fences follow the hi pack; supporting prose may still be English.

Range product semantics: sign classes, offsets, and step directions with exclusive/inclusive boundary twins.

Aliases: iterate

Syntax: for range <a>‥<b> step <s>, <c>‥<d> const <i>, <j> { }

Category#

control-flow

Examples#

radix/corpus/itera/cursor-iteratio.fab (canonical · keyword)#

Starts a for-each iteration statement.

# =============================================================================
# दोहराओ — Starts a for-each iteration statement.
# =============================================================================
#
# What this teaches:
#   • for-each iteration using stream functions — consumes values yielded via
#     `आगेबढ़ो` from `जनक` and `async_जनक` functions
#   • sync and async stream modes — `जनक` and `async_जनक` function signatures
#
# Common mistakes:
#   • Forgetting that stream functions must use `जनक` or `async_जनक` and yield
#     values with `आगेबढ़ो`.
#
# See also: सेवन, से, सीमा
# =============================================================================

# दोहराओ सेवन — संकेतक function return iteration
#
# दोहराओ सेवन <cursor-call> स्थिर <item> { <body> }
#
# GRAMMAR:
#   forInStmt  :← 'दोहराओ' 'सेवन' callExpr 'स्थिर' ident block
#   cursorDecl :← funcDecl 'जनक' | funcDecl 'async_जनक'
#
# EXPECTED OUTPUT:
#   Sync संकेतक values and collected सूची of doubled results.
#
# BACKEND:
#   Rust lowers `async_जनक` through the async-cursor carrier. Go supports the
#   `जनक` half and reports `async_जनक` as an explicit target gap.

# Multi-value sync stream function that yields values via आगेबढ़ो
fn grena(int n) generator → int {
    for range 0 ‥ n const i {
        yield i
    }
}

# Multi-value async stream function that yields values via आगेबढ़ो
fn grena_futurum(int n) async_generator → int {
    for range 0 ‥ n const i {
        yield i
    }
}

async_main {
    # Direct consumption of संकेतक yield stream
    print "Sync cursor iteration:"
    for from grena(3) const n {
        print "  numerus: §"(n)
    }

    # Collect all results from संकेतक function
    var list<int> effecta ← []
    for from grena(5) const n {
        effecta.append(n * 2)
    }
    print "Sync collected:"
    print effecta
    print "Async cursor iteration:"
    for from grena_futurum(3) const n {
        print "  async numerus: §"(n)
    }
}

Expected output:

Sync cursor iteration:
  numerus: 0
  numerus: 1
  numerus: 2
Sync collected:
[0, 2, 4, 6, 8]
Async cursor iteration:
  async numerus: 0
  async numerus: 1
  async numerus: 2

radix/corpus/itera/in-functione.fab (canonical · keyword)#

Starts a for-each iteration statement.

# =============================================================================
# दोहराओ — Starts a for-each iteration statement.
# =============================================================================
#
# What this teaches:
#   • accumulator patterns inside functions — using `दोहराओ सेवन` to compute sums, अधिकतम, and counts
#   • combining iteration with conditional logic (`यदि`) inside the loop body
#
# Common mistakes:
#   • Using the wrong iteration keyword — सेवन for values, से for indices/keys, सीमा for ranges; mixing them up produces unexpected results.
#
# See also: सेवन, से, सीमा
# =============================================================================

# दोहराओ सेवन — accumulator pattern inside फलन
#
# दोहराओ सेवन <सूची> स्थिर <item> { <body> }
#
# GRAMMAR:
#   forInStmt :← 'दोहराओ' 'सेवन' expr 'स्थिर' ident block
#
# EXPECTED OUTPUT:
#   Sums, अधिकतम, and counts above a threshold for sample listas.

fn योग(list<int> numeri) → int {
    var int total ← 0

    for from numeri const n {
        total ← total + n
    }

    return total
}

# Assumes non-empty सूची (seed from first element)
fn maximum(list<int> numeri) → int {
    var int max ← numeri[0]

    for from numeri const n {
        if n > max {
            max ← n
        }
    }

    return max
}

fn supra(list<int> numeri, int limen) → int {
    var int int ← 0

    for from numeri const n {
        if n > limen {
            int ← int + 1
        }
    }

    return int
}

main {
    const _ numeri ← [1, 2, 3, 4, 5]

    print योग(numeri)
    print maximum(numeri)
    print supra(numeri, 3)

    print योग([10, 20, 30])
    print maximum([5, 12, 8, 20, 3])
}

Expected output:

15
5
2
60
20

radix/corpus/itera/intervallum-gradus.fab (canonical · keyword)#

Starts a for-each iteration statement.

# =============================================================================
# दोहराओ — Starts a for-each iteration statement.
# =============================================================================
#
# What this teaches:
#   • range iteration with a step value using `प्रति` — controls stride between elements
#   • descending ranges: the step is a positive stride, the bounds pick the direction
#   • exclusive (`‥`) vs inclusive (`…`) range bounds with step
#
# Common mistakes:
#   • Using a step value that never reaches the end bound — the step is always a positive stride (zero or negative is an error); the bounds alone decide whether the range counts up or down.
#
# See also: सेवन, से, सीमा
# =============================================================================

# दोहराओ सीमा — ranges with step using per
#
# दोहराओ सीमा <start>‥<end> per <step> स्थिर <item> { <body> }
# दोहराओ सीमा <start>…<end> per <step> स्थिर <item> { <body> }
#
# GRAMMAR:
#   forRangeStmt :← 'दोहराओ' 'सीमा' rangeExpr 'per' expr ('स्थिर' | 'चर') ident block
#
# EXPECTED OUTPUT:
#   intervallum-gradus.expected — positive-step, inclusive, and descending
#   range values pinned from runner stdout.

main {
    # Step by 2 (exclusive: 0, 2, 4, 6, 8)
    for range 0‥10 step 2 const i {
        print i
    }

    # Step by 2 (inclusive: 0, 2, 4, 6, 8, 10)
    for range 0…10 step 2 const i {
        print i
    }

    # Step by 3
    for range 0‥15 step 3 const i {
        print i
    }

    # Descending: the bounds pick the direction, the step stays positive
    for range 10‥0 step 1 const i {
        print i
    }

    # Descending by 2
    for range 10‥0 step 2 const i {
        print i
    }
}

Expected output:

0
2
4
6
8
0
2
4
6
8
10
0
3
6
9
12
10
9
8
7
6
5
4
3
2
1
10
8
6
4
2

radix/corpus/itera/intervallum.fab (canonical · keyword)#

Starts a for-each iteration statement.

# =============================================================================
# दोहराओ — Starts a for-each iteration statement.
# =============================================================================
#
# What this teaches:
#   • range expressions with exclusive (`‥`) and inclusive (`…`) bounds
#   • the explicit `पहले` keyword for readability in exclusive ranges
#   • descending direction in range iteration
#
# Common mistakes:
#   • Confusing ‥ (exclusive upper bound) with … (inclusive upper bound) — off-by-one errors are the most common range bug.
#
# See also: सेवन, से, सीमा
# =============================================================================

# दोहराओ सीमा — range expressions with exclusive and inclusive bounds
#
# दोहराओ सीमा <start>‥<end> स्थिर <item> { <body> }       — exclusive end
# दोहराओ सीमा <start> पहले <end> स्थिर <item> { <body> }  — explicit exclusive
# दोहराओ सीमा <start>…<end> स्थिर <item> { <body> }        — inclusive end
#
# GRAMMAR:
#   forRangeStmt :← 'दोहराओ' 'सीमा' rangeExpr ('स्थिर' | 'चर') ident block
#
# EXPECTED OUTPUT:
#   intervallum.expected — exclusive, ante-exclusive, inclusive, non-zero,
#   and descending range values pinned from runner stdout.

main {
    # Basic range (exclusive: 0, 1, 2, 3, 4)
    for range 0‥5 const i {
        print i
    }

    # Explicit exclusive with पहले (same as ‥)
    for range 0 before 5 const i {
        print i
    }

    # Inclusive range with … (0, 1, 2, 3, 4, 5)
    for range 0…5 const i {
        print i
    }

    # Range starting from non-zero
    for range 5‥10 const i {
        print i
    }

    # Descending direction
    for range 5‥0 const i {
        print i
    }
}

Expected output:

0
1
2
3
4
0
1
2
3
4
0
1
2
3
4
5
5
6
7
8
9
5
4
3
2
1

radix/corpus/itera/lockstep-n2.fab (canonical · keyword)#

Lockstep walk of two lists with two binders.

# =============================================================================
# lockstep N=2 — one walk over two aligned lists.
# =============================================================================
#
# What this teaches:
#   • `for from` with a comma-separated source शृंखला walks N collections in
#     lockstep — one iteration per aligned index, no hand-written counter
#   • the binder शृंखला names one binder per source, in the same order
#   • equal lengths are a law: statically known lengths must already match at
#     check; dynamic lengths are guarded before the walk (fail-closed, never
#     truncated to the shorter list)
#
# Common mistakes:
#   • writing `xs[i]` with `for range` to keep two lists aligned — the
#     lockstep शृंखला exists exactly for that index-free shape
#   • expecting silent truncation on unequal lists — the walk fails closed
#
# See also: सेवन, पर
# =============================================================================

main {
    const list<string> labels ← ["one", "two", "three"]
    const list<int> values ← [1, 2, 3]
    for from labels, values const label, value {
        print label
        print value
    }
    const list<int> left ← [10, 20, 30]
    const list<int> right ← [1, 2, 3]
    for from left, right const a, b {
        print a - b
    }
}

Expected output:

one
1
two
2
three
3
9
18
27

radix/corpus/itera/lockstep-n3.fab (canonical · keyword)#

Lockstep walk of three lists with three binders.

# =============================================================================
# lockstep N=3 — one walk over three aligned lists.
# =============================================================================
#
# What this teaches:
#   • the source शृंखला takes any N — three collections walk in lockstep with
#     three binders, replacing a `for range` loop whose only job was keeping
#     three index-aligned lists together
#
# Common mistakes:
#   • nesting pair walks for three lists — the शृंखला is flat: one clause,
#     N sources, N binders
#
# See also: सेवन, पर
# =============================================================================

main {
    const list<int> bases ← [100, 200, 300]
    const list<int> keys ← [1, 2, 3]
    const list<int> payloads ← [10, 20, 30]
    for from bases, keys, payloads const base, key, payload {
        const int total ← base + key + payload
        print total
    }
    const list<int> rows ← [1, 2]
    const list<int> cols ← [3, 4]
    const list<int> cells ← [5, 6]
    for from rows, cols, cells const row, col, cell {
        const int grid ← row * col + cell
        print grid
    }
}

Expected output:

111
222
333
8
14

radix/corpus/itera/nidificatus.fab (canonical · keyword)#

Starts a for-each iteration statement.

# =============================================================================
# दोहराओ — Starts a for-each iteration statement.
# =============================================================================
#
# What this teaches:
#   • nested iteration — combining `दोहराओ सेवन` and `दोहराओ सीमा` loops for Cartesian products
#   • multiplication tables and coordinate grids as practical examples
#
# Common mistakes:
#   • Using सीमा (range iteration) when सेवन or से is needed for a collection — each nested दोहराओ must independently choose the correct mode.
#
# See also: सेवन, से, सीमा
# =============================================================================

# दोहराओ सेवन — nested loops (Cartesian product)
#
# दोहराओ सेवन <collection> स्थिर <item> { <body> }
# दोहराओ सीमा <start>‥<end> स्थिर <item> { <body> }
#
# GRAMMAR:
#   forInStmt    :← 'दोहराओ' 'सेवन' expr 'स्थिर' ident block
#   forRangeStmt :← 'दोहराओ' 'सीमा' rangeExpr 'स्थिर' ident block
#
# EXPECTED OUTPUT:
#   none — row/col pairs, multiplication table, coordinate grids.
#
# BACKEND:
#   Go backend does not emit nested दोहराओ yet — compile-only smoke.

main {
    # Nested सूची iteration — 3 × 3 combinations
    const list<int, 3> rows ← [1, 2, 3]
    const list<string, 3> cols ← ["A", "B", "C"]
    for from rows const row {
        for from cols const col {
            print row, col
        }
    }

    # Multiplication table over exclusive ranges 1‥4 (i, j ∈ {1,2,3})
    for range 1‥4 const i {
        for range 1‥4 const j {
            print i, "*", j, "←", i * j
        }
    }

    # Nested ranges: 4 × 4 grid of (x, y) with x, y ∈ {0,1,2,3}
    for range 0‥3 const x {
        for range 0‥3 const y {
            print x, y
        }
    }
}

Expected output:

1 A
1 B
1 C
2 A
2 B
2 C
3 A
3 B
3 C
1 * 1 ← 1
1 * 2 ← 2
1 * 3 ← 3
2 * 1 ← 2
2 * 2 ← 4
2 * 3 ← 6
3 * 1 ← 3
3 * 2 ← 6
3 * 3 ← 9
0 0
0 1
0 2
1 0
1 1
1 2
2 0
2 1
2 2

radix/corpus/itera/range-product-n2.fab (canonical · keyword)#

Cartesian walk of two ranges with two binders.

# =============================================================================
# range product N=2 — one walk over two declared numeric domains.
# =============================================================================
#
# What this teaches:
#   • `for range` with a comma-separated range शृंखला walks the Cartesian
#     product of the declared domains — every (i, j) pair, exactly once
#   • the binder शृंखला names one binder per range, in the same order
#   • order is structural: the leftmost range is the outermost walk, so the
#     output is row-major — each outer value carries the complete inner walk
#
# Common mistakes:
#   • expecting a zip — aligned walks are the separate `for from` शृंखला;
#     ranges of unequal visit counts are multiplied, never truncated
#   • writing nested `for range` loops with a hand-made counter to visit a
#     grid — the product शृंखला is the flat spelling of that nesting
#
# See also: सेवन, पर
# =============================================================================

main {
    for range 0‥2, 0‥2 const i, j {
        print i
        print j
    }
    for range 3‥5, 1‥3 const first, second {
        print first
        print second
    }
}

Expected output:

0
0
0
1
1
0
1
1
3
1
3
2
4
1
4
2

radix/corpus/itera/range-product-n3.fab (canonical · keyword)#

Cartesian walk of three ranges with three binders.

# =============================================================================
# range product N=3 — one walk over three declared numeric domains.
# =============================================================================
#
# What this teaches:
#   • the range शृंखला takes any N — three domains multiply into every
#     (i, j, k) triple with three binders, all alive at once
#   • nesting stays leftmost-outermost: i is outermost, k is innermost, and
#     each outer pair carries the complete innermost walk
#
# Common mistakes:
#   • nesting product walks for three axes — the शृंखला is flat: one clause,
#     N ranges, N binders
#   • reading the binders as a tuple to destructure — each binder is one
#     plain name scoped to the body
#
# See also: सेवन, पर
# =============================================================================

main {
    for range 1‥3, 2‥4, 0‥2 const i, j, k {
        print i * 100 + j * 10 + k
    }
    for range 5‥7, 1‥3, 0‥2 const first, second, third {
        print first * 100 + second * 10 + third
    }
}

Expected output:

120
121
130
131
220
221
230
231
510
511
520
521
610
611
620
621

radix/corpus/itera/range-product-semantics.fab (canonical · keyword)#

Range product semantics: sign classes, offsets, and step directions with exclusive/inclusive boundary twins.

# =============================================================================
# range product semantics — the sign/offset/step आव्यूह, end to end.
# =============================================================================
#
# What this teaches:
#   • every walk below is a Cartesian product in arity N=2: the leftmost
#     range is the outer axis, and each outer value carries the complete
#     ordered inner walk — no axis is ever zipped, reordered, or truncated
#   • sign classes are not normalized: crossing (-5‥5), negative-to-
#     negative (-8‥-3), and positive-to-positive (2‥7) axes all keep their
#     declared values, with and without a step
#   • a step applies to its own axis only: a stepped outer offset (1‥9 step
#     3) still walks the inner axis completely, and a stepped inner axis
#     (0‥10 step 2) never reorders the product
#   • boundary twins: each row appears in the exclusive form (`‥`) and the
#     inclusive form (`…`); the twin includes the upper endpoint only when
#     the progression reaches it — values are never appended or dropped to
#     force the endpoint (2…7 step 2 stays 2, 4, 6; -5…5 step 2 gains 5)
#
# Common mistakes:
#   • assuming a zero-based axis — offsets (3‥12, -2‥4) keep their declared
#     starts and ends on both axes
#   • assuming a descending range needs a negative step — the step is a
#     positive stride and the bounds pick the direction: 10‥0 step 2 walks
#     10, 8, 6, 4, 2 and includes 0 only in the inclusive twin
#
# See also: सेवन, पर
# =============================================================================

main {
    # crossing sign class, no step / stepped, exclusive + inclusive twins
    for range -5‥5, 2‥4 const i, j {
        print i
        print j
    }
    for range -5…5, 2…4 const i, j {
        print i
        print j
    }
    for range -5‥5 step 2, 2‥4 const i, j {
        print i
        print j
    }
    for range -5…5 step 2, 2…4 const i, j {
        print i
        print j
    }

    # negative-to-negative sign class, no step / stepped, twins
    for range -8‥-3, 2‥4 const i, j {
        print i
        print j
    }
    for range -8…-3, 2…4 const i, j {
        print i
        print j
    }
    for range -8‥-3 step 2, 2‥4 const i, j {
        print i
        print j
    }
    for range -8…-3 step 2, 2…4 const i, j {
        print i
        print j
    }

    # positive-to-positive sign class, no step / stepped, twins
    for range 2‥7, 2‥4 const i, j {
        print i
        print j
    }
    for range 2…7, 2…4 const i, j {
        print i
        print j
    }
    for range 2‥7 step 2, 2‥4 const i, j {
        print i
        print j
    }
    for range 2…7 step 2, 2…4 const i, j {
        print i
        print j
    }

    # offset row — both axes off zero, twins
    for range 3‥12, -2‥4 const i, j {
        print i
        print j
    }
    for range 3…12, -2…4 const i, j {
        print i
        print j
    }

    # stepped offset row — the stepped outer axis stays outer, twins
    for range 1‥9 step 3, -2‥4 const i, j {
        print i
        print j
    }
    for range 1…9 step 3, -2…4 const i, j {
        print i
        print j
    }

    # zero-start step on the inner axis (product form of 0‥10 step 2), twins
    for range 3‥5, 0‥10 step 2 const i, j {
        print i
        print j
    }
    for range 3…5, 0…10 step 2 const i, j {
        print i
        print j
    }

    # descending outer axis with a positive stride, twins
    for range 10‥0 step 2, 1‥3 const i, j {
        print i
        print j
    }
    for range 10…0 step 2, 1…3 const i, j {
        print i
        print j
    }
}

Expected output:

-5
2
-5
3
-4
2
-4
3
-3
2
-3
3
-2
2
-2
3
-1
2
-1
3
0
2
0
3
1
2
1
3
2
2
2
3
3
2
3
3
4
2
4
3
-5
2
-5
3
-5
4
-4
2
-4
3
-4
4
-3
2
-3
3
-3
4
-2
2
-2
3
-2
4
-1
2
-1
3
-1
4
0
2
0
3
0
4
1
2
1
3
1
4
2
2
2
3
2
4
3
2
3
3
3
4
4
2
4
3
4
4
5
2
5
3
5
4
-5
2
-5
3
-3
2
-3
3
-1
2
-1
3
1
2
1
3
3
2
3
3
-5
2
-5
3
-5
4
-3
2
-3
3
-3
4
-1
2
-1
3
-1
4
1
2
1
3
1
4
3
2
3
3
3
4
5
2
5
3
5
4
-8
2
-8
3
-7
2
-7
3
-6
2
-6
3
-5
2
-5
3
-4
2
-4
3
-8
2
-8
3
-8
4
-7
2
-7
3
-7
4
-6
2
-6
3
-6
4
-5
2
-5
3
-5
4
-4
2
-4
3
-4
4
-3
2
-3
3
-3
4
-8
2
-8
3
-6
2
-6
3
-4
2
-4
3
-8
2
-8
3
-8
4
-6
2
-6
3
-6
4
-4
2
-4
3
-4
4
2
2
2
3
3
2
3
3
4
2
4
3
5
2
5
3
6
2
6
3
2
2
2
3
2
4
3
2
3
3
3
4
4
2
4
3
4
4
5
2
5
3
5
4
6
2
6
3
6
4
7
2
7
3
7
4
2
2
2
3
4
2
4
3
6
2
6
3
2
2
2
3
2
4
4
2
4
3
4
4
6
2
6
3
6
4
3
-2
3
-1
3
0
3
1
3
2
3
3
4
-2
4
-1
4
0
4
1
4
2
4
3
5
-2
5
-1
5
0
5
1
5
2
5
3
6
-2
6
-1
6
0
6
1
6
2
6
3
7
-2
7
-1
7
0
7
1
7
2
7
3
8
-2
8
-1
8
0
8
1
8
2
8
3
9
-2
9
-1
9
0
9
1
9
2
9
3
10
-2
10
-1
10
0
10
1
10
2
10
3
11
-2
11
-1
11
0
11
1
11
2
11
3
3
-2
3
-1
3
0
3
1
3
2
3
3
3
4
4
-2
4
-1
4
0
4
1
4
2
4
3
4
4
5
-2
5
-1
5
0
5
1
5
2
5
3
5
4
6
-2
6
-1
6
0
6
1
6
2
6
3
6
4
7
-2
7
-1
7
0
7
1
7
2
7
3
7
4
8
-2
8
-1
8
0
8
1
8
2
8
3
8
4
9
-2
9
-1
9
0
9
1
9
2
9
3
9
4
10
-2
10
-1
10
0
10
1
10
2
10
3
10
4
11
-2
11
-1
11
0
11
1
11
2
11
3
11
4
12
-2
12
-1
12
0
12
1
12
2
12
3
12
4
1
-2
1
-1
1
0
1
1
1
2
1
3
4
-2
4
-1
4
0
4
1
4
2
4
3
7
-2
7
-1
7
0
7
1
7
2
7
3
1
-2
1
-1
1
0
1
1
1
2
1
3
1
4
4
-2
4
-1
4
0
4
1
4
2
4
3
4
4
7
-2
7
-1
7
0
7
1
7
2
7
3
7
4
3
0
3
2
3
4
3
6
3
8
4
0
4
2
4
4
4
6
4
8
3
0
3
2
3
4
3
6
3
8
3
10
4
0
4
2
4
4
4
6
4
8
4
10
5
0
5
2
5
4
5
6
5
8
5
10
10
1
10
2
8
1
8
2
6
1
6
2
4
1
4
2
2
1
2
2
10
1
10
2
10
3
8
1
8
2
8
3
6
1
6
2
6
3
4
1
4
2
4
3
2
1
2
2
2
3
0
1
0
2
0
3

radix/corpus/itera/apud-decline.fab (supporting · reject)#

पर coordinate iteration declines arity mismatch and unindexed iterables with structured issues.

# =============================================================================
# पर decline — arity mismatch and unindexed iterables fail closed.
# =============================================================================
#
# Decline rows (reject reason in each comment):
#   1. arity mismatch — `at [i]` over टेंसर<f32, [2, 3]> binds 1 coordinate
#      for rank 2: SEM010 itera_apud_arity_mismatch (expected=2, actual=1);
#      partial binding never happens — the statement declines whole
#   2. ragged — `list<list<f32>>` is a सूची, and a सूची is rank 1
#      (`rows[r]` takes one index): SEM010 itera_apud_arity_mismatch
#      (expected=1, actual=2). Changed by D3.1 — it was
#      itera_apud_requires_shaped_iterable while lists had no `at` form.
#   3. set — a समुच्चय has no index to name: SEM010
#      itera_apud_requires_indexed_iterable (`at` needs a सूची, तालिका,
#      टेंसर, or आव्यूह)
#   4. generic dims — `size R, size C` dims are not concrete at lowering, so
#      the base लेन declines with the MIR unsupported diagnostic
#      "दोहराओ collection before iterator MIR lowering" (declared fail-closed;
#      `faber check` admits the symbolic rank — the decline is at MIR, pinned
#      in radix-module lower_test, not in this checker oracle)
#
# Common mistakes:
#   • expecting half-bound coordinates on mismatch — arity == rank is a type
#     error, never a partial bind
#
# See also: पर, दोहराओ, सेवन, टेंसर
# =============================================================================

# पर reject cases — expected compile failure
#
# WHY: documents the arity and indexed-iterable contracts for coordinate
# iteration. Cases 1–3 must reject under `faber check` with the tokens
# pinned in apud-decline.expected; case 4 is an MIR-lane decline kept here as
# the documented fourth row.

fn arity(टेंसर<f32, [2, 3]> grid) → void {
    for from grid at [i] const cell {
        print cell
    }
}

fn ragged(list<list<f32>> rows) → void {
    for from rows at [r, c] const cell {
        print cell
    }
}

fn members(set<int> s) → void {
    for from s at [i] const member {
        print member
    }
}

fn generic<size R, size C>(टेंसर<f32, [R, C]> grid) → void {
    for from grid at [r, c] const cell {
        print cell
    }
}

Expected: compilation rejects this example.

radix/corpus/itera/lockstep-decline.fab (supporting · reject)#

Lockstep declines: source/binder arity, at-coordinate cardinality, and statically known unequal lengths fail closed.

# =============================================================================
# lockstep decline — arity, at-cardinality, and static length laws.
# =============================================================================
#
# Decline rows (reject reason in each comment):
#   1. arity — 2 sources carry 1 binder: SEM010
#      itera_lockstep_source_binder_arity_mismatch (one binder per source;
#      never a partial bind, same family as the पर arity rule)
#   2. at-cardinality — `at [i, j]` on a list zip: SEM010
#      itera_lockstep_at_coordinate_cardinality (the shared coordinate does
#      not grow with N; one clause names the one index)
#   3. static lengths — two inline literals of unequal element count are
#      exact witnesses: SEM010 itera_lockstep_length_mismatch (dynamic
#      list<T> lengths defer to the MIR walk guard, which aborts before the
#      first body visit — pinned in radix-module lower_test, not in this
#      checker oracle)
#
# Common mistakes:
#   • expecting a partial bind or silent truncation — every count/length law
#     here declines the whole statement
#
# See also: सेवन, पर
# =============================================================================

# lockstep reject cases — expected compile failure
#
# WHY: documents the source/binder arity law, the one-shared-coordinate law,
# and the fail-closed equal-length admission for the lockstep शृंखला.

fn arity(सूची<संख्या> ks, सूची<संख्या> vs) → void {
    for from ks, vs const k {
        print k
    }
}

fn cardinality(सूची<संख्या> ks, सूची<संख्या> vs) → void {
    for from ks, vs at [i, j] const k, v {
        print k
    }
}

fn lengths() → void {
    for from [1, 2, 3], [4, 5] const k, v {
        print k
    }
}

Expected: compilation rejects this example.

radix/corpus/itera/range-product-decline.fab (supporting · reject)#

Range product declines: source/binder arity, extent/binder shadowing, and a mixed range/plain series fail closed.

# =============================================================================
# range product decline — arity, shadowing, and mixed-source laws.
# =============================================================================
#
# Decline rows (reject reason in each comment):
#   1. arity — 2 ranges carry 1 binder: SEM010
#      itera_range_source_binder_arity_mismatch (one binder per range;
#      never a partial bind, never a silent first-range-only walk)
#   2. shadowing — a binder spelling that also names an extent reference:
#      SEM010 itera_range_extent_binder_shadowing (ranges lower outside the
#      binder scope, so the shared spelling would name two different
#      bindings)
#   3. mixed source — `0‥m, n` joins a range with a plain value: SEM010
#      itera_range_mixed_source (every member must be a range expression;
#      the product is never a zip fallback and never borrows the
#      single-range `सीमा` issue)
#
# Common mistakes:
#   • expecting the walk to bind what it can and skip the rest — every
#     product law here declines the whole statement
#
# See also: सेवन, पर
# =============================================================================

# range product reject cases — expected compile failure
#
# WHY: documents the source/binder arity law, the extent/binder shadowing
# law, and the every-member-is-a-range law for the Cartesian शृंखला.

fn counts(संख्या m, संख्या n) → void {
    for range 0‥m, 0‥n const i {
        print i
    }
}

fn shadows(संख्या k) → void {
    for range 0‥k, 1‥2 const k, j {
        print k
    }
}

fn mixes(संख्या m, संख्या n) → void {
    for range 0‥m, n const i, j {
        print i
    }
}

Expected: compilation rejects this example.