From aa3173f85b706e50bd71de8889300e9aa71a0734 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Mon, 5 Sep 2022 14:00:14 +0200 Subject: [PATCH] tweak: Add skeleton for calculating dimishing returns allocation --- .../FunctionRegistry/Library/FR_Danger.res | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Danger.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Danger.res index 96576821..6136e46a 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Danger.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Danger.res @@ -168,7 +168,16 @@ module Internals = { } result } - @dead let getDiminishingMarginalReturnsEquilibrium = "To do" + let diminishingMarginalReturnsSkeleton = ( + lambda1, + lambda2, + funds, + increment, + environment, + reducer, + ) => { + Ok(castFloatToInternalNumber(0.0)) + } } let library = [ @@ -343,4 +352,25 @@ let library = [ ], (), ), + Function.make( + ~name="diminishingMarginalReturnsSkeleton", + ~nameSpace, + ~output=EvtNumber, + ~requiresNamespace=false, + ~examples=[`Danger.diminishingMarginalReturnsSkeleton({|x| x+1}, {|y| 10}, 100, 1)`], + ~definitions=[ + FnDefinition.make( + ~name="diminishingMarginalReturnsSkeleton", + ~inputs=[FRTypeLambda, FRTypeLambda, FRTypeNumber, FRTypeNumber], + ~run=(inputs, _, env, reducer) => + switch inputs { + | [IEvLambda(lambda1), IEvLambda(lambda2), IEvNumber(funds), IEvNumber(increment)] => + Internals.diminishingMarginalReturnsSkeleton(lambda1, lambda2, funds, increment, env, reducer) + | _ => Error("Error in Danger.diminishingMarginalReturnsSkeleton") + }, + (), + ), + ], + (), + ), ]