From a77bb36219f479c922819a185e3e4ce4c867e9ab Mon Sep 17 00:00:00 2001 From: Vyacheslav Matyukhin Date: Sun, 18 Sep 2022 20:13:54 +0400 Subject: [PATCH] var name cleanups --- packages/squiggle-lang/scripts/bench-map-reduce.mjs | 10 +++++----- packages/squiggle-lang/scripts/run-file.mjs | 8 ++++---- packages/squiggle-lang/scripts/run.mjs | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/squiggle-lang/scripts/bench-map-reduce.mjs b/packages/squiggle-lang/scripts/bench-map-reduce.mjs index e6bf8ca7..5dfbca0f 100755 --- a/packages/squiggle-lang/scripts/bench-map-reduce.mjs +++ b/packages/squiggle-lang/scripts/bench-map-reduce.mjs @@ -15,13 +15,13 @@ const maxP = 5; for (let p = 0; p <= maxP; p++) { const size = Math.pow(10, p); - const prj = SqProject.create(); - prj.setSource( + const project = SqProject.create(); + project.setSource( "main", `List.upTo(1, ${size}) |> map({|x| List.upTo(1, 100) |> reduce(0, {|a,b|a+b})})` ); - const t = measure(() => { - prj.run("main"); + const time = measure(() => { + project.run("main"); }); - console.log(`1e${p}`, "\t", t); + console.log(`1e${p}`, "\t", time); } diff --git a/packages/squiggle-lang/scripts/run-file.mjs b/packages/squiggle-lang/scripts/run-file.mjs index 90fa6203..23041a5a 100755 --- a/packages/squiggle-lang/scripts/run-file.mjs +++ b/packages/squiggle-lang/scripts/run-file.mjs @@ -14,8 +14,8 @@ const measure = (cb, times = 1) => { return (t2 - t1) / 1000; }; -const red = (s) => `\x1b[31m${s}\x1b[0m`; -const green = (s) => `\x1b[32m${s}\x1b[0m`; +const red = (str) => `\x1b[31m${str}\x1b[0m`; +const green = (str) => `\x1b[32m${str}\x1b[0m`; const program = new Command(); @@ -39,7 +39,7 @@ if (!src) { } project.setSource("main", src); -const t = measure(() => project.run("main")); +const time = measure(() => project.run("main")); const bindings = project.getBindings("main"); const result = project.getResult("main"); @@ -51,7 +51,7 @@ if (options.output) { console.log( "Time:", - String(t), + String(time), result.tag === "Error" ? red(result.tag) : green(result.tag), result.tag === "Error" ? result.value.toString() : "" ); diff --git a/packages/squiggle-lang/scripts/run.mjs b/packages/squiggle-lang/scripts/run.mjs index 0425c46e..6f842eef 100755 --- a/packages/squiggle-lang/scripts/run.mjs +++ b/packages/squiggle-lang/scripts/run.mjs @@ -1,18 +1,18 @@ #!/usr/bin/env node import { SqProject } from "@quri/squiggle-lang"; -const p = SqProject.create(); +const project = SqProject.create(); const src = process.argv[2]; if (!src) { throw new Error("Expected src"); } console.log(`Running ${src}`); -p.setSource("a", src); -p.run("a"); +project.setSource("a", src); +project.run("a"); -const result = p.getResult("a"); +const result = project.getResult("a"); console.log(result.tag, result.value.toString()); -const bindings = p.getBindings("a"); +const bindings = project.getBindings("a"); console.log(bindings.asValue().toString());