From cfc1fd2239c7278fc03cf13ec7f853502f17c020 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Wed, 20 Apr 2022 13:25:13 -0400 Subject: [PATCH] tweak: minor code org --- .../PointSetDist/NumericShapeCombination2.res | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/NumericShapeCombination2.res b/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/NumericShapeCombination2.res index 1f3ff787..746dba88 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/NumericShapeCombination2.res +++ b/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/NumericShapeCombination2.res @@ -1,6 +1,17 @@ +// Types + let emptyXYShape: PointSetTypes.xyShape = {xs: [], ys: []} exception LogicallyInconsistent(string) +// Helpers + +let getArithmeticComplementOfDistributionForSubstraction = ( + dist: PointSetTypes.xyShape, +): PointSetTypes.xyShape => { + let newXs = Belt.Array.map(dist.xs, x => -.x) + {xs: newXs, ys: dist.ys} +} + let getApproximatePdfOfContinuousDistributionAtPoint = ( dist: PointSetTypes.xyShape, point: float, @@ -39,6 +50,8 @@ let getApproximatePdfOfContinuousDistributionAtPoint = ( result } +// Inner functions + let addContinuousContinuous = ( s1: PointSetTypes.xyShape, s2: PointSetTypes.xyShape, @@ -87,12 +100,7 @@ let addContinuousContinuous = ( {xs: newXs, ys: newYs} } -let getArithmeticComplementOfDistributionForSubstraction = ( - dist: PointSetTypes.xyShape, -): PointSetTypes.xyShape => { - let newXs = Belt.Array.map(dist.xs, x => -.x) - {xs: newXs, ys: dist.ys} -} +// Main function let combineShapesContinuousContinuous = ( op: Operation.algebraicOperation,