Very minor cleanup

This commit is contained in:
Ozzie Gooen 2020-08-09 12:15:45 +01:00
parent e55a981be7
commit a9a13b7d54
3 changed files with 12 additions and 6 deletions

View File

@ -42,6 +42,7 @@ module FieldText = {
<Antd.Form.Item label={label |> R.ste}> <Antd.Form.Item label={label |> R.ste}>
<Antd.Input.TextArea <Antd.Input.TextArea
value value
autosize=true
onChange={BsReform.Helpers.handleChange(handleChange)} onChange={BsReform.Helpers.handleChange(handleChange)}
onBlur={_ => validate()} onBlur={_ => validate()}
/> />
@ -164,7 +165,8 @@ module DemoDist = {
| Ok(`DistPlus(distPlus1)) => | Ok(`DistPlus(distPlus1)) =>
<DistPlusPlot distPlus={DistPlus.T.normalize(distPlus1)} /> <DistPlusPlot distPlus={DistPlus.T.normalize(distPlus1)} />
| Ok(`Function(f, a)) => | Ok(`Function(f, a)) =>
let results = E.A.Floats.range(0.0, 10.0, 100) // Problem: When it gets the function, it doesn't save state about previous commands
let results = E.A.Floats.range(0.0, 10.0, 2)
|> E.A.fmap(r => |> E.A.fmap(r =>
DistPlusRenderer.runFunction( DistPlusRenderer.runFunction(
inputs1, inputs1,
@ -204,7 +206,10 @@ let make = () => {
~onSubmit=({state}) => {None}, ~onSubmit=({state}) => {None},
~initialState={ ~initialState={
//guesstimatorString: "mm(normal(-10, 2), uniform(18, 25), lognormal({mean: 10, stdev: 8}), triangular(31,40,50))", //guesstimatorString: "mm(normal(-10, 2), uniform(18, 25), lognormal({mean: 10, stdev: 8}), triangular(31,40,50))",
guesstimatorString: "foo(t) = mm(normal(5,t));foo", // , triangular(30, 40, 60) guesstimatorString: "
foo(t) = normal(t,2)
bar(t) = foo(t)
bar",
domainType: "Complete", domainType: "Complete",
xPoint: "50.0", xPoint: "50.0",
xPoint2: "60.0", xPoint2: "60.0",

View File

@ -297,7 +297,7 @@ module Render = {
but most often it will produce a RenderedDist. but most often it will produce a RenderedDist.
This function is used mainly to turn a parse tree into a single RenderedDist This function is used mainly to turn a parse tree into a single RenderedDist
that can then be displayed to the user. */ that can then be displayed to the user. */
let toLeaf = let rec toLeaf =
( (
evaluationParams: ExpressionTypes.ExpressionTree.evaluationParams, evaluationParams: ExpressionTypes.ExpressionTree.evaluationParams,
node: t, node: t,
@ -337,6 +337,7 @@ let toLeaf =
r, r,
) )
|> E.O.toResult("Undeclared variable " ++ r) |> E.O.toResult("Undeclared variable " ++ r)
|> E.R.bind(_, toLeaf(evaluationParams))
| `FunctionCall(name, args) => | `FunctionCall(name, args) =>
callableFunction(evaluationParams, name, args) callableFunction(evaluationParams, name, args)
}; };

View File

@ -112,7 +112,7 @@ module Internals = {
ins := addVariable(ins^, name, node); ins := addVariable(ins^, name, node);
None; None;
} }
| `Expression(node) => Some(runNode(ins^, node)), | `Expression(node) => Some(runNode(ins^, node) |> E.R.fmap(r => (ins, r))),
) )
|> E.A.O.concatSomes |> E.A.O.concatSomes
|> E.A.R.firstErrorOrOpen; |> E.A.R.firstErrorOrOpen;
@ -158,7 +158,7 @@ let run = (inputs: Inputs.inputs) => {
inputs inputs
|> Internals.distPlusRenderInputsToInputs |> Internals.distPlusRenderInputsToInputs
|> Internals.inputsToLeaf |> Internals.inputsToLeaf
|> E.R.bind(_, r => |> E.R.bind(_, ((lastIns,r)) =>
r r
|> renderIfNeeded(inputs) |> renderIfNeeded(inputs)
|> ( |> (
@ -195,7 +195,7 @@ let run2 = (inputs: Inputs.inputs) => {
inputs inputs
|> Internals.distPlusRenderInputsToInputs |> Internals.distPlusRenderInputsToInputs
|> Internals.inputsToLeaf |> Internals.inputsToLeaf
|> E.R.bind(_, exportDistPlus(inputs)); |> E.R.bind(_,((a,b)) => exportDistPlus(inputs,b))
}; };
let runFunction = let runFunction =