tweak: minor code org

This commit is contained in:
NunoSempere 2022-04-20 13:25:13 -04:00
parent c8a505dcf0
commit cfc1fd2239

View File

@ -1,6 +1,17 @@
// Types
let emptyXYShape: PointSetTypes.xyShape = {xs: [], ys: []} let emptyXYShape: PointSetTypes.xyShape = {xs: [], ys: []}
exception LogicallyInconsistent(string) 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 = ( let getApproximatePdfOfContinuousDistributionAtPoint = (
dist: PointSetTypes.xyShape, dist: PointSetTypes.xyShape,
point: float, point: float,
@ -39,6 +50,8 @@ let getApproximatePdfOfContinuousDistributionAtPoint = (
result result
} }
// Inner functions
let addContinuousContinuous = ( let addContinuousContinuous = (
s1: PointSetTypes.xyShape, s1: PointSetTypes.xyShape,
s2: PointSetTypes.xyShape, s2: PointSetTypes.xyShape,
@ -87,12 +100,7 @@ let addContinuousContinuous = (
{xs: newXs, ys: newYs} {xs: newXs, ys: newYs}
} }
let getArithmeticComplementOfDistributionForSubstraction = ( // Main function
dist: PointSetTypes.xyShape,
): PointSetTypes.xyShape => {
let newXs = Belt.Array.map(dist.xs, x => -.x)
{xs: newXs, ys: dist.ys}
}
let combineShapesContinuousContinuous = ( let combineShapesContinuousContinuous = (
op: Operation.algebraicOperation, op: Operation.algebraicOperation,