MVFM

st

Mutable local state. Declares variables scoped to a single program execution, with operations for reading and writing their values.

Included on the default interpreter.

const app = mvfm(prelude, st);

const prog = app({ n: "number" }, ($) => {
  const counter = $.let($.input.n);
  counter.set($.mul(counter.get(), 2));
  return counter.get();
});

await fold(defaults(app), injectInput(prog, { n: 21 }));
Ctrl+Enter