From d61f521a0e3c15d3061e37c20b822c5c42827e6a Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Thu, 31 Mar 2022 08:41:50 -0400 Subject: [PATCH] fmap -> outputmap --- .../GenericDist/GenericOperation__Test.res | 16 ++++++++-------- .../GenericDist/GenericDist_GenericOperation.res | 2 +- .../GenericDist_GenericOperation.resi | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/squiggle-lang/__tests__/GenericDist/GenericOperation__Test.res b/packages/squiggle-lang/__tests__/GenericDist/GenericOperation__Test.res index 2cb65a55..59f9b126 100644 --- a/packages/squiggle-lang/__tests__/GenericDist/GenericOperation__Test.res +++ b/packages/squiggle-lang/__tests__/GenericDist/GenericOperation__Test.res @@ -12,9 +12,9 @@ let normalDist20: GenericDist_Types.genericDist = #Symbolic(#Normal({mean: 20.0, let uniformDist: GenericDist_Types.genericDist = #Symbolic(#Uniform({low: 9.0, high: 10.0})) let {toFloat, toDist, toString, toError} = module(GenericDist_GenericOperation.Output) -let {run, fmap} = module(GenericDist_GenericOperation) +let {run, outputMap} = module(GenericDist_GenericOperation) let run = run(params) -let fmap = fmap(params) +let outputMap = outputMap(params) let toExt: option<'a> => 'a = E.O.toExt( "Should be impossible to reach (This error is in test file)", ) @@ -37,7 +37,7 @@ describe("mixture", () => { test("on two normal distributions", () => { let result = run(#mixture([(normalDist10, 0.5), (normalDist20, 0.5)])) - ->fmap(#fromDist(#toFloat(#Mean))) + ->outputMap(#fromDist(#toFloat(#Mean))) ->toFloat ->toExt expect(result)->toBeCloseTo(15.28) @@ -48,7 +48,7 @@ describe("toPointSet", () => { test("on symbolic normal distribution", () => { let result = run(#fromDist(#toDist(#toPointSet), normalDist)) - ->fmap(#fromDist(#toFloat(#Mean))) + ->outputMap(#fromDist(#toFloat(#Mean))) ->toFloat ->toExt expect(result)->toBeCloseTo(5.09) @@ -56,7 +56,7 @@ describe("toPointSet", () => { test("on sample set distribution with under 4 points", () => { let result = - run(#fromDist(#toDist(#toPointSet), #SampleSet([0.0, 1.0, 2.0, 3.0])))->fmap( + run(#fromDist(#toDist(#toPointSet), #SampleSet([0.0, 1.0, 2.0, 3.0])))->outputMap( #fromDist(#toFloat(#Mean)), ) expect(result)->toEqual(#GenDistError(Other("Converting sampleSet to pointSet failed"))) @@ -65,9 +65,9 @@ describe("toPointSet", () => { Skip.test("on sample set", () => { let result = run(#fromDist(#toDist(#toPointSet), normalDist)) - ->fmap(#fromDist(#toDist(#toSampleSet(1000)))) - ->fmap(#fromDist(#toDist(#toPointSet))) - ->fmap(#fromDist(#toFloat(#Mean))) + ->outputMap(#fromDist(#toDist(#toSampleSet(1000)))) + ->outputMap(#fromDist(#toDist(#toPointSet))) + ->outputMap(#fromDist(#toFloat(#Mean))) ->toFloat ->toExt expect(result)->toBeCloseTo(5.09) diff --git a/packages/squiggle-lang/src/rescript/GenericDist/GenericDist_GenericOperation.res b/packages/squiggle-lang/src/rescript/GenericDist/GenericDist_GenericOperation.res index b6c3814a..1c84dcd6 100644 --- a/packages/squiggle-lang/src/rescript/GenericDist/GenericDist_GenericOperation.res +++ b/packages/squiggle-lang/src/rescript/GenericDist/GenericDist_GenericOperation.res @@ -135,7 +135,7 @@ let rec run = (extra, fnName: operation): outputType => { let runFromDist = (extra, fnName, dist) => run(extra, #fromDist(fnName, dist)) let runFromFloat = (extra, fnName, float) => run(extra, #fromFloat(fnName, float)) -let fmap = ( +let outputMap = ( extra, input: outputType, fn: GenericDist_Types.Operation.singleParamaterFunction, diff --git a/packages/squiggle-lang/src/rescript/GenericDist/GenericDist_GenericOperation.resi b/packages/squiggle-lang/src/rescript/GenericDist/GenericDist_GenericOperation.resi index f8acdc42..37d6593a 100644 --- a/packages/squiggle-lang/src/rescript/GenericDist/GenericDist_GenericOperation.resi +++ b/packages/squiggle-lang/src/rescript/GenericDist/GenericDist_GenericOperation.resi @@ -17,7 +17,7 @@ let runFromDist: ( GenericDist_Types.genericDist, ) => outputType let runFromFloat: (params, GenericDist_Types.Operation.fromDist, float) => outputType -let fmap: (params, outputType, GenericDist_Types.Operation.singleParamaterFunction) => outputType +let outputMap: (params, outputType, GenericDist_Types.Operation.singleParamaterFunction) => outputType module Output: { let toDist: outputType => option