Node.js λ

node-to-igropyr

Hand it a Node.js route, a middleware, or a whole small Express app — get back the Igropyr port.

An AI coding agent · re-architecture, not transliteration

What it does

Re-architecture, not transliteration

Node's single-threaded event loop with Promises, async/await and defensive try/catch becomes Igropyr's Erlang-style actor model with spawn/send/receive, a supervised worker pool, and Let It Crash. The agent produces Scheme a maintainer of the repo would have written — not JavaScript wearing parentheses.

async/await → straight-line

The scheduler yields for you. I/O calls already block only the calling process, so promise chains flatten into ordinary sequential code — no promise type invented.

try/catch → Let It Crash

Blanket 500-catchers are deleted: that is the worker supervisor's job. A guard stays only where there is a specific, meaningful recovery.

shared state → gen-server

A module-level Map shared across requests becomes a process (gen-server), because workers never share mutable state except through a process.

The mapping

How Node constructs land in Igropyr

A selection from the agent's conversion table. It reads the real library source before writing, since the API evolves.

Node.js / ExpressIgropyr
async function / await p straight-line synchronous Scheme; I/O parks the calling process only
try { } catch → 500 delete it — the supervisor retries then answers 500 (Let It Crash)
app.get('/x', h) (app-get app "/x" (lambda (req res) ...))
(req, res, next) (lambda (req res next) ...) — call (next)
req.params.id (req-param req "id")
req.body (json) (req-json req); read with (json-ref j "name")
res.json(obj) (send-json! res alist)
res.status(c) (set-status! res c) then a send-*!
SSE / res.write (sse-start! res) + (sse-send! res msg) in a spawned process
ws.on('message') (app-ws app "/p" (lambda (ws req) ...)), loop on (ws-recv ws)
setInterval / worker (spawn (lambda () (let loop () ... (sleep-ms n) (loop))))
EventEmitter / pub-sub (igropyr pubsub): subscribe / publish
stateful singleton a gen-server ((igropyr gen-server))
JSON.parse / stringify (string->json s) / (json->string v)
Get it

The agent, in one file

It is a single Markdown agent definition — house rules, the full conversion table, the invariants, the workflow, and the current public API surface. Feed it to any AI coding agent as its instructions and point it at the Node code to port.