.mjs for all scripts

This commit is contained in:
Vyacheslav Matyukhin 2022-09-18 19:18:10 +04:00
parent a78797bb9c
commit 66d9cb0ab1
No known key found for this signature in database
GPG Key ID: 3D2A774C5489F96C
4 changed files with 9 additions and 9 deletions

View File

@ -2,12 +2,12 @@ Various scripts used for development, benchmarking and testing.
None of these are bundled in the NPM package yet.
# run.js
# run.mjs
`scripts/run.js` allows quick testing of Squiggle programs:
`scripts/run.mjs` allows quick testing of Squiggle programs:
```
$ ./scripts/run.js '2+2'
$ ./scripts/run.mjs '2+2'
Running 2+2
Ok 4
@{__result__: 4}

View File

@ -1,5 +1,5 @@
#!/usr/bin/env node
const s = require("@quri/squiggle-lang");
import { SqProject } from "@quri/squiggle-lang";
const measure = (cb, times = 1) => {
const t1 = new Date();
@ -15,7 +15,7 @@ const maxP = 5;
for (let p = 0; p <= maxP; p++) {
const size = Math.pow(10, p);
const prj = s.SqProject.create();
const prj = SqProject.create();
prj.setSource(
"main",
`List.upTo(1, ${size}) |> map({|x| List.upTo(1, 100) |> reduce(0, {|a,b|a+b})})`

View File

@ -1,5 +1,5 @@
#!/usr/bin/env node
const s = require("@quri/squiggle-lang");
import { SqProject } from "@quri/squiggle-lang";
const measure = (cb, times = 1) => {
const t1 = new Date();
@ -15,7 +15,7 @@ const maxP = 7;
for (let p = 0; p <= maxP; p++) {
const size = Math.pow(10, p);
const project = s.SqProject.create();
const project = SqProject.create();
project.setSource("list", `l = List.upTo(1,${size})`);
project.run("list");
project.setSource("map", "l |> map({|x| x})");

View File

@ -1,7 +1,7 @@
#!/usr/bin/env node
const s = require("@quri/squiggle-lang");
import { SqProject } from "@quri/squiggle-lang";
const p = s.SqProject.create();
const p = SqProject.create();
const src = process.argv[2];
if (!src) {