From b48a0575d9348ef70dff05e28b36973739c4841f Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Wed, 8 Jun 2022 08:21:20 -0700 Subject: [PATCH] Cumprod and formatting --- .../FunctionRegistry/FunctionRegistry_Library.res | 8 ++++++++ .../rescript/ReducerInterface/ReducerInterface_Date.res | 2 +- .../ReducerInterface/ReducerInterface_Duration.res | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Library.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Library.res index 12445f71..130f4c80 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Library.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Library.res @@ -223,6 +223,14 @@ let registry = [ ), ], ), + Function.make( + ~name="Cumulative Prod", + ~definitions=[ + ArrayNumberDist.make("cumprod", r => + r->E.A.Floats.cumsum->E.A2.fmap(Wrappers.evNumber)->Wrappers.evArray->Ok + ), + ], + ), Function.make( ~name="Diff", ~definitions=[ diff --git a/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_Date.res b/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_Date.res index dc04a474..02c3affc 100644 --- a/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_Date.res +++ b/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_Date.res @@ -24,4 +24,4 @@ let dispatch = (call: EV.functionCall, _: DistributionOperation.env): option< EV.EvDate(DateTime.Date.addDuration(d1, d2))->Ok->Some | _ => None } -} \ No newline at end of file +} diff --git a/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_Duration.res b/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_Duration.res index a11aa745..4e10dfa0 100644 --- a/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_Duration.res +++ b/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_Duration.res @@ -29,4 +29,4 @@ let dispatch = (call: EV.functionCall, _: DistributionOperation.env): option< EV.EvTimeDuration(DateTime.Duration.divide(d1, d2))->Ok->Some | _ => None } -} \ No newline at end of file +}