Graph Computer/JavaScript reference
Developer overview

JavaScript reference

evaluate(rows, steps) runs one column program on this device and resolves to a Float64Array in input order.

Run it from this site

Run this example in the console on Graph Computer. In your own web app, import https://graphcomputer.hopperlabs.ai/runtime/columns.js. The module loads the kernel from the same host.

JavaScript · browser console
const { evaluate } = await import("/runtime/columns.js");
const rows = "3, 12\n2, 7.5\n4, 6";
const result = await evaluate(rows, ["multiply", "add"]);
Array.from(result);
// [48, 22.5, 30]
Open the same program in the workbench ↗

Calculate rainfall and export XLSX with the workbook API →

Arguments

rows
A string containing one pair of finite numbers per line. Separate A and B with a comma or a tab. Use a decimal point and omit headers, currency symbols and thousands separators. Signed values and scientific notation are supported.
steps
An array of one to eight operations. "add" adds B, and "multiply" multiplies by B. The accumulator starts at A. Every step reads the same row’s B.

Limits and errors

A call accepts up to 1,000,000 rows. A missing value, malformed row, unknown operation, empty program or non-finite result rejects the promise. A malformed row includes its one-based row number in the error.

The kernel uses binary floating point. Decimal currency arithmetic may require a rounding policy in your application. This column runner evaluates every supplied row on each call.

Execution and storage

The first call loads the kernel. Later calls reuse it on the same page. Your numeric inputs stay in memory. Each returned array holds its own result.

Local runs & member access

Choose where to run and what to save in your private program library.