From fd957ef40136a708c61940d8b4dd4bacf363d4fb Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Sat, 30 Apr 2022 13:43:46 -0400 Subject: [PATCH 1/6] Mixture last argument can be float --- .../ReducerInterface/ReducerInterface_GenericDistribution.res | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_GenericDistribution.res b/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_GenericDistribution.res index 7f5ad1eb..30585395 100644 --- a/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_GenericDistribution.res +++ b/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_GenericDistribution.res @@ -131,6 +131,7 @@ module Helpers = { | Error(err) => GenDistError(ArgumentError(err)) } } + | Some(EvNumber(_)) | Some(EvDistribution(_)) => switch parseDistributionArray(args) { | Ok(distributions) => mixtureWithDefaultWeights(distributions) From f8f6a1ecc624934c581c4c3dcc35b110fd4566a9 Mon Sep 17 00:00:00 2001 From: Quinn Dougherty Date: Sat, 30 Apr 2022 13:57:41 -0400 Subject: [PATCH 2/6] hotfix: deleted `browser` field of `package.json`s Value: [1e-9 to 1e-5] --- packages/components/package.json | 1 - packages/squiggle-lang/package.json | 1 - .../DistributionOperation/DistributionOperation.res | 4 ++-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/components/package.json b/packages/components/package.json index fbddaf2c..29c158fc 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -87,7 +87,6 @@ "@types/react": "17.0.43" }, "source": "./src/index.ts", - "browser": "./dist/bundle.js", "main": "./dist/src/index.js", "types": "./dist/src/index.d.ts" } diff --git a/packages/squiggle-lang/package.json b/packages/squiggle-lang/package.json index ab3e0b72..40f7e7c7 100644 --- a/packages/squiggle-lang/package.json +++ b/packages/squiggle-lang/package.json @@ -62,7 +62,6 @@ "webpack-cli": "^4.9.2" }, "source": "./src/js/index.ts", - "browser": "./dist/bundle.js", "main": "./dist/src/js/index.js", "types": "./dist/src/js/index.d.ts" } diff --git a/packages/squiggle-lang/src/rescript/Distributions/DistributionOperation/DistributionOperation.res b/packages/squiggle-lang/src/rescript/Distributions/DistributionOperation/DistributionOperation.res index 9952c6da..5f07c6a8 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/DistributionOperation/DistributionOperation.res +++ b/packages/squiggle-lang/src/rescript/Distributions/DistributionOperation/DistributionOperation.res @@ -154,12 +154,12 @@ let rec run = (~env, functionCallInfo: functionCallInfo): outputType => { ->GenericDist.toPointSet(~xyPointLength, ~sampleCount, ()) ->E.R2.fmap(r => Dist(PointSet(r))) ->OutputLocal.fromResult - | ToDist(Scale(#Logarithm, f)) => + | ToDist(Scale(#Logarithm, f)) => dist ->GenericDist.pointwiseCombinationFloat(~toPointSetFn, ~algebraicCombination=#Logarithm, ~f) ->E.R2.fmap(r => Dist(r)) ->OutputLocal.fromResult - | ToDist(Scale(#Power, f)) => + | ToDist(Scale(#Power, f)) => dist ->GenericDist.pointwiseCombinationFloat(~toPointSetFn, ~algebraicCombination=#Power, ~f) ->E.R2.fmap(r => Dist(r)) From adb3b335ce837630f3b21a1776383f72276a9c45 Mon Sep 17 00:00:00 2001 From: Quinn Dougherty Date: Sat, 30 Apr 2022 13:58:32 -0400 Subject: [PATCH 3/6] 17 increment Value: [1e-10 to 1e-7] --- packages/components/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/package.json b/packages/components/package.json index 29c158fc..4888a0a5 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@quri/squiggle-components", - "version": "0.2.16", + "version": "0.2.17", "license": "MIT", "dependencies": { "@quri/squiggle-lang": "^0.2.8", From 615051d1c61fd45fcbe8df41d49704d9eb726451 Mon Sep 17 00:00:00 2001 From: Quinn Dougherty Date: Sat, 30 Apr 2022 14:10:01 -0400 Subject: [PATCH 4/6] hotfix: brackets in `components/README.md` --- packages/components/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/README.md b/packages/components/README.md index 4d073a14..12cd87a9 100644 --- a/packages/components/README.md +++ b/packages/components/README.md @@ -17,7 +17,7 @@ Add to `App.js`: ```jsx import { SquiggleEditor } from "@quri/squiggle-components"; -; +; ``` # Build storybook for development From 2776a4369302c81b7b4fe8b454971b991afc5e25 Mon Sep 17 00:00:00 2001 From: Quinn Dougherty Date: Sat, 30 Apr 2022 14:10:54 -0400 Subject: [PATCH 5/6] lint --- packages/components/README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/components/README.md b/packages/components/README.md index 12cd87a9..03eb5750 100644 --- a/packages/components/README.md +++ b/packages/components/README.md @@ -17,7 +17,10 @@ Add to `App.js`: ```jsx import { SquiggleEditor } from "@quri/squiggle-components"; -; +; ``` # Build storybook for development From d6cec6886cd1effd80e6a80111ab7d89c66600b7 Mon Sep 17 00:00:00 2001 From: Sam Nolan Date: Sat, 30 Apr 2022 18:40:18 +0000 Subject: [PATCH 6/6] Clean up the props, removing unused and making some optional --- packages/components/src/components/SquiggleChart.tsx | 2 -- .../components/src/components/SquiggleEditor.tsx | 12 +++--------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/packages/components/src/components/SquiggleChart.tsx b/packages/components/src/components/SquiggleChart.tsx index 31cd9787..699a7e28 100644 --- a/packages/components/src/components/SquiggleChart.tsx +++ b/packages/components/src/components/SquiggleChart.tsx @@ -144,8 +144,6 @@ export interface SquiggleChartProps { diagramStop?: number; /** If the result is a function, how many points along the function it samples */ diagramCount?: number; - /** variables declared before this expression */ - environment?: unknown; /** When the environment changes */ onChange?(expr: squiggleExpression): void; /** CSS width of the element */ diff --git a/packages/components/src/components/SquiggleEditor.tsx b/packages/components/src/components/SquiggleEditor.tsx index 2c01f72f..23686a4f 100644 --- a/packages/components/src/components/SquiggleEditor.tsx +++ b/packages/components/src/components/SquiggleEditor.tsx @@ -32,16 +32,14 @@ export interface SquiggleEditorProps { diagramStop?: number; /** If the result is a function, how many points along the function it samples */ diagramCount?: number; - /** The environment, other variables that were already declared */ - environment?: unknown; /** when the environment changes. Used again for notebook magic*/ onChange?(expr: squiggleExpression): void; /** The width of the element */ - width: number; + width?: number; /** Previous variable declarations */ - bindings: bindings; + bindings?: bindings; /** JS Imports */ - jsImports: jsImports; + jsImports?: jsImports; } const Input = styled.div` @@ -61,7 +59,6 @@ export let SquiggleEditor: React.FC = ({ diagramStop, diagramCount, onChange, - environment, bindings = defaultBindings, jsImports = defaultImports, }: SquiggleEditorProps) => { @@ -87,7 +84,6 @@ export let SquiggleEditor: React.FC = ({ diagramStart={diagramStart} diagramStop={diagramStop} diagramCount={diagramCount} - environment={environment} onChange={onChange} bindings={bindings} jsImports={jsImports} @@ -145,8 +141,6 @@ export interface SquigglePartialProps { diagramCount?: number; /** when the environment changes. Used again for notebook magic*/ onChange?(expr: bindings): void; - /** The width of the element */ - width: number; /** Previously declared variables */ bindings?: bindings; /** Variables imported from js */