F0/F1: safe execution core (exec gate, bounded IO, process-group timeout), structured invoke records, run options, 15 language presets, register/unset/probe/config, view stderr/exit/ms, and node/bash gold tests.
583 B
583 B
title: foreign invoke JSON input import foreign:lib/foreign.mq.md
main
数值表 =
| 数值 |
|---|
| 1 |
| 2 |
| 3 |
| 4 |
统计 =
let s = "";
process.stdin.on("data", d => { s += d; });
process.stdin.on("end", () => {
const xs = JSON.parse(s);
console.log(JSON.stringify({ n: xs.length, sum: xs.reduce((a, b) => a + b, 0) }));
});
记录 = > foreign.invoke code=统计 input=数值表 output="json"
统计结果 = result