2022-09-18 15:14:32 +00:00
|
|
|
#!/usr/bin/env node
|
2022-09-18 15:18:10 +00:00
|
|
|
import { SqProject } from "@quri/squiggle-lang";
|
2022-09-18 15:14:32 +00:00
|
|
|
|
2022-09-18 15:18:10 +00:00
|
|
|
const p = SqProject.create();
|
2022-09-18 15:14:32 +00:00
|
|
|
|
|
|
|
const src = process.argv[2];
|
|
|
|
if (!src) {
|
|
|
|
throw new Error("Expected src");
|
|
|
|
}
|
|
|
|
console.log(`Running ${src}`);
|
|
|
|
p.setSource("a", src);
|
|
|
|
p.run("a");
|
|
|
|
|
|
|
|
const result = p.getResult("a");
|
|
|
|
console.log(result.tag, result.value.toString());
|
|
|
|
|
|
|
|
const bindings = p.getBindings("a");
|
|
|
|
console.log(bindings.asValue().toString());
|