Minor refactors

This commit is contained in:
Ozzie Gooen 2022-04-20 13:05:26 -04:00
parent 81e478ba49
commit 41cacd2aae
2 changed files with 6 additions and 24 deletions

View File

@ -83,8 +83,7 @@ let toPointSet = (
pointSetDistLength: xyPointLength, pointSetDistLength: xyPointLength,
kernelWidth: None, kernelWidth: None,
}, },
) )->GenericDist_Types.Error.resultStringToResultError
->GenericDist_Types.Error.resultStringToResultError
} }
} }
@ -217,8 +216,6 @@ module AlgebraicCombination = {
secondOperandIsGreaterThanZero, secondOperandIsGreaterThanZero,
secondOperandHasMassAt1, secondOperandHasMassAt1,
]) ])
Js.log2("PMASS", toFloatOperation(t2, ~toPointSetFn, ~distToFloatOperation=#Pdf(1.0)))
Js.log4("HIHI", items, t1, t2)
switch items { switch items {
| Error(r) => Some(r) | Error(r) => Some(r)
| Ok([true, _, _]) => Some(Other("First input of logarithm must be fully greater than 0")) | Ok([true, _, _]) => Some(Other("First input of logarithm must be fully greater than 0"))

View File

@ -28,24 +28,9 @@ module Operation = {
| Algebraic | Algebraic
| Pointwise | Pointwise
type arithmeticOperation = [ type arithmeticOperation = Operation.algebraicOperation
| #Add let arithmeticToFn = Operation.Algebraic.toFn
| #Multiply let arithmeticToString = Operation.Algebraic.toString
| #Subtract
| #Divide
| #Power
| #Logarithm
]
let arithmeticToFn = (arithmetic: arithmeticOperation) =>
switch arithmetic {
| #Add => \"+."
| #Multiply => \"*."
| #Subtract => \"-."
| #Power => \"**"
| #Divide => \"/."
| #Logarithm => (a, b) => log(a) /. log(b)
}
type toFloat = [ type toFloat = [
| #Cdf(float) | #Cdf(float)
@ -105,8 +90,8 @@ module Operation = {
| ToString(ToString) => `toString` | ToString(ToString) => `toString`
| ToString(ToSparkline(n)) => `toSparkline(${E.I.toString(n)})` | ToString(ToSparkline(n)) => `toSparkline(${E.I.toString(n)})`
| ToBool(IsNormalized) => `isNormalized` | ToBool(IsNormalized) => `isNormalized`
| ToDistCombination(Algebraic, _, _) => `algebraic` | ToDistCombination(Algebraic, operation, _) => `algebraic-${arithmeticToString(operation)}`
| ToDistCombination(Pointwise, _, _) => `pointwise` | ToDistCombination(Pointwise, operation, _) => `pointwise-${arithmeticToString(operation)}`
} }
let toString = (d: genericFunctionCallInfo): string => let toString = (d: genericFunctionCallInfo): string =>