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 16:13:54 +00:00
|
|
|
const project = 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}`);
|
2022-09-18 16:13:54 +00:00
|
|
|
project.setSource("a", src);
|
|
|
|
project.run("a");
|
2022-09-18 15:14:32 +00:00
|
|
|
|
2022-09-18 16:13:54 +00:00
|
|
|
const result = project.getResult("a");
|
2022-09-18 15:14:32 +00:00
|
|
|
console.log(result.tag, result.value.toString());
|
|
|
|
|
2022-09-18 16:13:54 +00:00
|
|
|
const bindings = project.getBindings("a");
|
2022-09-18 15:14:32 +00:00
|
|
|
console.log(bindings.asValue().toString());
|