003 pairwise basic

✓ Passing This code compiles and runs correctly.

Code

// TEST: kernel.pairwise basic iteration
//
// Verifies:
// 1. kernel:init creates proper view with kernel branch
// 2. kernel:pairwise transforms into nested loops accessing k.ptr[i]/k.ptr[j]
// 3. The view flows through continuations properly

~import "$std/kernel"
~import "$std/io"

// Declare shape
~std.kernel:shape(Body) {
    mass: f64,
}

// Initialize with 3 bodies and run pairwise
~std.kernel:init(Body) {
    { mass: 1.0 },
    { mass: 2.0 },
    { mass: 3.0 },
}
| kernel k |>
    std.kernel:pairwise { k.mass += k.other.mass }

// Print after pairwise completes
~std.io:print.ln("pairwise complete")
input.kz

Expected Output

pairwise complete

Test Configuration

MUST_RUN