.mjs for all scripts
This commit is contained in:
parent
a78797bb9c
commit
66d9cb0ab1
|
@ -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}
|
||||
|
|
|
@ -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})})`
|
|
@ -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})");
|
|
@ -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) {
|
Loading…
Reference in New Issue
Block a user