link: run pretty
This commit is contained in:
parent
b292a3e6fd
commit
943e63b379
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"rescript.settings.autoRunCodeAnalysis": true
|
||||||
|
}
|
|
@ -63,9 +63,15 @@ describe("FunctionRegistry Library", () => {
|
||||||
testEvalToBe("SampleSet.fromList([3,5,2,3,5,2,3,5,2,3,3,5])", "Ok(Sample Set Distribution)")
|
testEvalToBe("SampleSet.fromList([3,5,2,3,5,2,3,5,2,3,3,5])", "Ok(Sample Set Distribution)")
|
||||||
testEvalToBe("SampleSet.fromList([3,5,2,3,5,2,3,5,2,3,3,5])", "Ok(Sample Set Distribution)")
|
testEvalToBe("SampleSet.fromList([3,5,2,3,5,2,3,5,2,3,3,5])", "Ok(Sample Set Distribution)")
|
||||||
testEvalToBe("SampleSet.fromFn({|| sample(normal(5,2))})", "Ok(Sample Set Distribution)")
|
testEvalToBe("SampleSet.fromFn({|| sample(normal(5,2))})", "Ok(Sample Set Distribution)")
|
||||||
testEvalToBe("SampleSet.min(SampleSet.fromDist(normal(50,2)), 2)", "Ok(Sample Set Distribution)")
|
testEvalToBe(
|
||||||
|
"SampleSet.min(SampleSet.fromDist(normal(50,2)), 2)",
|
||||||
|
"Ok(Sample Set Distribution)",
|
||||||
|
)
|
||||||
testEvalToBe("mean(SampleSet.min(SampleSet.fromDist(normal(50,2)), 2))", "Ok(2)")
|
testEvalToBe("mean(SampleSet.min(SampleSet.fromDist(normal(50,2)), 2))", "Ok(2)")
|
||||||
testEvalToBe("SampleSet.max(SampleSet.fromDist(normal(50,2)), 10)", "Ok(Sample Set Distribution)")
|
testEvalToBe(
|
||||||
|
"SampleSet.max(SampleSet.fromDist(normal(50,2)), 10)",
|
||||||
|
"Ok(Sample Set Distribution)",
|
||||||
|
)
|
||||||
testEvalToBe(
|
testEvalToBe(
|
||||||
"addOne(t)=t+1; SampleSet.toList(SampleSet.map(SampleSet.fromList([1,2,3,4,5,6]), addOne))",
|
"addOne(t)=t+1; SampleSet.toList(SampleSet.map(SampleSet.fromList([1,2,3,4,5,6]), addOne))",
|
||||||
"Ok([2,3,4,5,6,7])",
|
"Ok([2,3,4,5,6,7])",
|
||||||
|
|
|
@ -61,23 +61,22 @@ module Internals = {
|
||||||
let choose = ((n, k)) => factorial(n) /. (factorial(n -. k) *. factorial(k))
|
let choose = ((n, k)) => factorial(n) /. (factorial(n -. k) *. factorial(k))
|
||||||
let pow = (base, exp) => Js.Math.pow_float(~base, ~exp)
|
let pow = (base, exp) => Js.Math.pow_float(~base, ~exp)
|
||||||
let binomial = ((n, k, p)) => choose((n, k)) *. pow(p, k) *. pow(1.0 -. p, n -. k)
|
let binomial = ((n, k, p)) => choose((n, k)) *. pow(p, k) *. pow(1.0 -. p, n -. k)
|
||||||
let applyFunctionAtPoint = (aLambda, internalNumber: internalExpressionValue, environment, reducer): result<
|
let applyFunctionAtPoint = (
|
||||||
ReducerInterface_InternalExpressionValue.t,
|
|
||||||
Reducer_ErrorValue.errorValue,
|
|
||||||
> => {
|
|
||||||
let x = internalNumber
|
|
||||||
let result = Reducer_Expression_Lambda.doLambdaCall(
|
|
||||||
aLambda,
|
aLambda,
|
||||||
list{x},
|
internalNumber: internalExpressionValue,
|
||||||
environment,
|
environment,
|
||||||
reducer,
|
reducer,
|
||||||
)
|
): result<ReducerInterface_InternalExpressionValue.t, Reducer_ErrorValue.errorValue> => {
|
||||||
|
let x = internalNumber
|
||||||
|
let result = Reducer_Expression_Lambda.doLambdaCall(aLambda, list{x}, environment, reducer)
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
let internalZero = ReducerInterface_InternalExpressionValue.IEvNumber(0.0)
|
let internalZero = ReducerInterface_InternalExpressionValue.IEvNumber(0.0)
|
||||||
let applyFunctionAtZero = (aLambda,environment , reducer) => applyFunctionAtPoint(aLambda, internalZero, environment, reducer)
|
let applyFunctionAtZero = (aLambda, environment, reducer) =>
|
||||||
let applyFunctionAtFloat = (aLambda, point, environment, reducer) => applyFunctionAtPoint(aLambda, ReducerInterface_InternalExpressionValue.IEvNumber(point))
|
applyFunctionAtPoint(aLambda, internalZero, environment, reducer)
|
||||||
let integrateFunction = (aLambda, min:float, max:float, increment, environment, reducer) => {
|
let applyFunctionAtFloat = (aLambda, point, environment, reducer) =>
|
||||||
|
applyFunctionAtPoint(aLambda, ReducerInterface_InternalExpressionValue.IEvNumber(point))
|
||||||
|
let integrateFunction = (aLambda, min: float, max: float, increment, environment, reducer) => {
|
||||||
// Should be easy, but tired today.
|
// Should be easy, but tired today.
|
||||||
0.0
|
0.0
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user