Qy

1 program Added 2026-03-06T10:53:03Z Agent: claude-codeModel: claude-sonnet-4-6WebSearch: enabled Evidence Report issue View issues
Aliases: —
Provenance: commit 66a49fb4a4 · authored 2026-03-06T11:53:41+01:00 · agent claude-code · model claude-sonnet-4-6

Sources mentioning this language

1 source · not in taxonomy (canonical name didn't match any upstream)
LLM (this repo) · 1

LLM-contributed programs

Matrix Multiplication

Provenance: commit 66a49fb4a4 · authored 2026-03-06T11:53:41+01:00 · agent claude-code · model claude-sonnet-4-6 · WebSearch enabled
code.qy · added: 2026-03-06T10:53:03Z
type Matrix = (
    data: MutArrayBox[F32],
    rows: I64,
    cols: I64
);

def matrix (r: I64, c: I64) = (
    new Matrix(new MutArrayBox[F32](r * c), r, c)
);

def matrix_index (m, ir, ic) = (
    // NOTE: all matrices store indices in COLUMN MAJOR format
    ic * m.rows + ir
);
def matrix_ptr (m: Ptr[Matrix], ir, ic) = (
    m.data.ptr(matrix_index(m, ir, ic))
);
def matrix_get (m: Ptr[Matrix], ir, ic) = (
    *matrix_ptr(m, ir, ic)
);

def print_matrix (m: Ptr[Matrix]) = do {
    val i = push mut 0L;
    
    val comma = push ", ";
    val lsqbrk = push "[";
    val lpad = push " ";
    val rsqbrk = push "]";
    val rsqbrk_row_end = push "]\n";
    val lfeed_row_end = push "\n";

    val ss = push new_string_stream(default_heap_allocator);
    while (*i < m.rows) do {
        string_stream_push_string_view(ss, 
            to_string_view(if (*i == 0L) { lsqbrk } else { lpad }));

        val j = push mut 0L;
        string_stream_push_string_view(ss, to_string_view(lsqbrk));
        while (*j < m.cols) do {
            string_stream_push_number_f32(ss, matrix_get(m, *i, *j), 10, 0);
            if (*j < m.cols - 1L) {
                string_stream_push_string_view(ss, to_string_view(comma));
            };
            j := 1L + *j;
        };
        string_stream_push_string_view(ss, to_string_view(rsqbrk));

        string_stream_push_string_view(ss,
            to_string_view(if (*i == m.rows-1L) { rsqbrk_row_end } else { lfeed_row_end }));

        i := 1L + *i;
    };

    file_print(file_stdout, string_stream_flush(ss));
};

def main () = do {
    file_print(file_stdout, "2D Matrices!\n");
    val rows = 4L;
    val cols = 4L;
    val m = push new Matrix(
        new MutArrayBox[F32](rows * cols),
        rows, cols
    );
    print_matrix(m);
    0
};

Contribute — propose a file extension

Tell us where to find evidence about Qy (mapped to pl/qy). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/Qy/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← QX Qyri →