diff --git a/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_ExpressionValue.res b/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_ExpressionValue.res index 633e6a3c..bfb79df1 100644 --- a/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_ExpressionValue.res +++ b/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_ExpressionValue.res @@ -12,7 +12,7 @@ type rec expressionValue = | EvSymbol(string) | EvArray(array) | EvRecord(Js.Dict.t) - | EvDist(GenericDist_Types.genericDist) + | EvDistribution(GenericDist_Types.genericDist) type functionCall = (string, array) @@ -36,7 +36,7 @@ let rec toString = aValue => ->Js.String.concatMany("") `{${pairs}}` } - | EvDist(dist) => `${GenericDist.toString(dist)}` + | EvDistribution(dist) => `${GenericDist.toString(dist)}` } let toStringWithType = aValue => @@ -47,7 +47,7 @@ let toStringWithType = aValue => | EvSymbol(_) => `Symbol::${toString(aValue)}` | EvArray(_) => `Array::${toString(aValue)}` | EvRecord(_) => `Record::${toString(aValue)}` - | EvDist(_) => `Distribution::${toString(aValue)}` + | EvDistribution(_) => `Distribution::${toString(aValue)}` } let argsToString = (args: array): string => { diff --git a/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_GenericDistribution.res b/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_GenericDistribution.res index eb5704ae..18f152d4 100644 --- a/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_GenericDistribution.res +++ b/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_GenericDistribution.res @@ -30,9 +30,9 @@ let catchAndConvertTwoArgsToDists = (args: array): option<( GenericDist_Types.genericDist, )> => { switch args { - | [EvDist(a), EvDist(b)] => Some((a, b)) - | [EvNumber(a), EvDist(b)] => Some((GenericDist.fromFloat(a), b)) - | [EvDist(a), EvNumber(b)] => Some((a, GenericDist.fromFloat(b))) + | [EvDistribution(a), EvDistribution(b)] => Some((a, b)) + | [EvNumber(a), EvDistribution(b)] => Some((GenericDist.fromFloat(a), b)) + | [EvDistribution(a), EvNumber(b)] => Some((a, GenericDist.fromFloat(b))) | _ => None } } @@ -64,7 +64,7 @@ let genericOutputToReducerValue = (o: GenericDist_GenericOperation.outputType): Reducer_ErrorValue.errorValue, > => switch o { - | Dist(d) => Ok(ReducerInterface_ExpressionValue.EvDist(d)) + | Dist(d) => Ok(ReducerInterface_ExpressionValue.EvDistribution(d)) | Float(d) => Ok(EvNumber(d)) | String(d) => Ok(EvString(d)) | GenDistError(NotYetImplemented) => Error(RETodo("Function not yet implemented")) @@ -79,19 +79,19 @@ let dispatchToGenericOutput = (call: ExpressionValue.functionCall): option< > => { let (fnName, args) = call switch (fnName, args) { - | ("sample", [EvDist(dist)]) => toFloatFn(#Sample, dist) - | ("mean", [EvDist(dist)]) => toFloatFn(#Mean, dist) - | ("normalize", [EvDist(dist)]) => toDistFn(Normalize, dist) - | ("toPointSet", [EvDist(dist)]) => toDistFn(ToPointSet, dist) - | ("cdf", [EvDist(dist), EvNumber(float)]) => toFloatFn(#Cdf(float), dist) - | ("pdf", [EvDist(dist), EvNumber(float)]) => toFloatFn(#Pdf(float), dist) - | ("inv", [EvDist(dist), EvNumber(float)]) => toFloatFn(#Inv(float), dist) - | ("toSampleSet", [EvDist(dist), EvNumber(float)]) => + | ("sample", [EvDistribution(dist)]) => toFloatFn(#Sample, dist) + | ("mean", [EvDistribution(dist)]) => toFloatFn(#Mean, dist) + | ("normalize", [EvDistribution(dist)]) => toDistFn(Normalize, dist) + | ("toPointSet", [EvDistribution(dist)]) => toDistFn(ToPointSet, dist) + | ("cdf", [EvDistribution(dist), EvNumber(float)]) => toFloatFn(#Cdf(float), dist) + | ("pdf", [EvDistribution(dist), EvNumber(float)]) => toFloatFn(#Pdf(float), dist) + | ("inv", [EvDistribution(dist), EvNumber(float)]) => toFloatFn(#Inv(float), dist) + | ("toSampleSet", [EvDistribution(dist), EvNumber(float)]) => toDistFn(ToSampleSet(Belt.Int.fromFloat(float)), dist) - | ("truncateLeft", [EvDist(dist), EvNumber(float)]) => toDistFn(Truncate(Some(float), None), dist) - | ("truncateRight", [EvDist(dist), EvNumber(float)]) => + | ("truncateLeft", [EvDistribution(dist), EvNumber(float)]) => toDistFn(Truncate(Some(float), None), dist) + | ("truncateRight", [EvDistribution(dist), EvNumber(float)]) => toDistFn(Truncate(None, Some(float)), dist) - | ("truncate", [EvDist(dist), EvNumber(float1), EvNumber(float2)]) => + | ("truncate", [EvDistribution(dist), EvNumber(float1), EvNumber(float2)]) => toDistFn(Truncate(Some(float1), Some(float2)), dist) | (("add" | "multiply" | "subtract" | "divide" | "exponentiate") as arithmetic, [a, b] as args) => catchAndConvertTwoArgsToDists(args) -> E.O2.fmap(((fst, snd)) =>